I have created this table view section header. It is basically a UIView container where I wrapped all elements that will go on that section header.
This container view is returned by
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
and everything is working fine.
Now I want the header to appear in fade in, as the table appears. So, I initially declare alpha = 0 for the container and then do this on viewDidAppear: (ah, this table is inside a view controller that is appearing).
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[UIView animateWithDuration:1.0
animations:^{
[self.tableHeader setAlpha:1.0f];
}];
}
Nothing happens and the header continues to be invisible.
I have tried to add:
[self.tableView beginUpdates]; //and
[self.tableView beginUpdates];
before and after the mentioned animation, without success.
It appears to me that the table header is not updating and continues to be invisible.
First, put a
NSLogon bothviewDidAppearandtableView:viewForHeaderInSection:You gonna see that the
viewDidAppearexecutes first, once tableView has an asynchronous loading and you don’t know when will call theviewForHeaderInSection.One workaround is the following:
Just call the animation when the table will return the viewHeader.