ios - Repostioning a UITableView -


i have view controller with

  1. sub view(half main view size)
  2. table view(half main view size)
  3. navigation bar button

on click of button want sub view hide , table view show full main view size....it working fine below code, not first time. first time when click bar button hides sub view , resizes table view not show result on screen(works rest time). if incase scroll tableview before clicking navigation bar first time works fines...i think has table view loading cant make out

code

if(ismapvisible==yes) {     [mapview sethidden:yes];     [tblview setframe:cgrectmake(self.view.frame.origin.x,                                  self.view.frame.origin.y+self.navigationcontroller.navigationbar.frame.size.height+[uiapplication sharedapplication].statusbarframe.size.height,                                  self.view.frame.size.width,                                   self.view.frame.size.height-self.navigationcontroller.navigationbar.frame.size.height-[uiapplication sharedapplication].statusbarframe.size.height-self.navigationcontroller.tabbarcontroller.tabbar.frame.size.height)];      ismapvisible=no; } else {     [mapview sethidden:no];     [tblview setframe:cgrectmake(mapview.frame.origin.x,                                  mapview.frame.origin.y+mapview.frame.size.height+1,                                  mapview.frame.size.width,                                  mapview.frame.size.height)];      ismapvisible=yes; }   - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      activitycell *cell = (activitycell*)[tableview dequeuereusablecellwithidentifier:@"activitycell" forindexpath:indexpath];      return cell; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return 10; }  - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:    (nsindexpath *)indexpath {     return 100; } 

call method this

[self performselector:@selector(methodtochangetableviewframe) withobject:nil afterdelay:0.1f];  -(void)methodtochangetableviewframe {          // here code     if(ismapvisible==yes) {         [mapview sethidden:yes];         [tblview setframe:cgrectmake(self.view.frame.origin.x,                                      self.view.frame.origin.y+self.navigationcontroller.navigationbar.frame.size.height+[uiapplication sharedapplication].statusbarframe.size.height,                                      self.view.frame.size.width,                                       self.view.frame.size.height-self.navigationcontroller.navigationbar.frame.size.height-[uiapplication sharedapplication].statusbarframe.size.height-self.navigationcontroller.tabbarcontroller.tabbar.frame.size.height)];          ismapvisible=no;     } else {         [mapview sethidden:no];         [tblview setframe:cgrectmake(mapview.frame.origin.x,                                      mapview.frame.origin.y+mapview.frame.size.height+1,                                      mapview.frame.size.width,                                      mapview.frame.size.height)];          ismapvisible=yes;     } } 

Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

SQL Server - MyCTE query based on 24 hour period (next day) -