iphone - Animating a table view section header -


i have created table view section header. uiview container wrapped elements go on section header.

this container view returned

- (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section  

and working fine.

now want header appear in fade in, table appears. so, declare alpha = 0 container , on viewdidappear: (ah, table inside view controller appearing).

- (void)viewdidappear:(bool)animated {     [super viewdidappear:animated];      [uiview animatewithduration:1.0          animations:^{              [self.tableheader setalpha:1.0f];      }];  } 

nothing happens , header continues invisible.

i have tried add:

[self.tableview beginupdates]; //and [self.tableview beginupdates]; 

before , after mentioned animation, without success.

it appears me table header not updating , continues invisible.

first, put nslog on both viewdidappear , tableview:viewforheaderinsection:

you gonna see viewdidappear executes first, once tableview has asynchronous loading , don't know when call viewforheaderinsection.

one workaround following:

-(uiview *) tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section {      _tableheader = [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 100)];     _tableheader.backgroundcolor = [uicolor redcolor];     _tableheader.alpha = 0;      [uiview animatewithduration:1.0                  animations:^{                      [_tableheader setalpha:1.0f];                  }];      return _tableheader;  } 

just call animation when table return viewheader.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -