Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section not called

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
    [view vChangeBackgroundToCyan];
}

after

[self.delegateForTableController.tvDelegated insertSections:[NSIndexSet indexSetWithIndex:ip.section] withRowAnimation:UITableViewRowAnimationRight];

And how to call them?

like image 383
user4951 Avatar asked Mar 08 '14 07:03

user4951


2 Answers

The class returned by tableView:viewForHeaderInSection: needs to be a subclass of UITableViewHeaderFooterView for the tableView:willDisplayHeaderView:forSection: method to get called.

If the returned view is of some other type, the tableView:willDisplayHeaderView:forSection: method will not get called.

like image 160
DaveDude Avatar answered Nov 04 '22 22:11

DaveDude


As far as I know - tableView:willDisplayHeaderView:forSection: is being called only if you provide your own view in – tableView:viewForHeaderInSection:.

I also hope your delegate reference is not nil.

like image 1
r.szeja Avatar answered Nov 04 '22 21:11

r.szeja