Reloading tableView header in ios7

后端 未结 2 1172
野趣味
野趣味 2021-01-04 14:10

How can I do it without reloading all table?

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    UIView *header;

         


        
2条回答
  •  北海茫月
    2021-01-04 14:49

    You have to reload the whole section to reload the header.

    [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation: UITableViewRowAnimationAutomatic];
    

    OR

    You could grab a handle to the view and update it manually:

    UIView *headerView = [self.tableView headerViewForSection:section];
    //... update your view properties here
    [headerView setNeedsDisplay];
    [headerView setNeedsLayout];
    

提交回复
热议问题