Search code examples
objective-cuitableviewviewfooter

viewForFooterInSection did finish loading


I am trying to change the elements on my section footer directly as it finish loading

But when i try following way

-(void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section {

    UITableViewHeaderFooterView* footerView = [self.tableView footerViewForSection:0];
}

footerView returns nil

The only solution that works for me is performSelector:withObject:afterDelay

Shouldn't there exist a delegate method like the one mentioned above but with didDisplayFooterView instead?

Thanks :)


Solution

  • Your footer view is passed in as a the parameter view. Just check that the section is the one you want:

    -(void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:   (NSInteger)section {
    
      if(section == 0) {
        //view is your footer view
      }
    }