对于viewForHeaderInSection中的自定义单元格,重新加载特定的viewForHeaderInSection IOS

我想重新加载viewForHeaderInSection的情况下在viewForHeaderInSection自定义单元重新加载特定的viewForHeaderInSection IOS。

我使用了下面的代码

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

但整个部分将重新加载

我也尝试以下通过创build自定义视图

SearchHeaderView是自定义视图

  - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ lblPrice_Header.text = [NSString stringWithFormat:@"%d",cartSum] ; return SearchHeaderView; } -(void)cartSum :(id)sender{ ..... ....... ======================================= cartSum =cartSum+[[subArray objectAtIndex:j] intValue]*price; UIView *headerVw = [self.tableView headerViewForSection:section]; [headerVw setNeedsDisplay]; [headerVw setNeedsLayout]; } 

但它不会重新加载部分。

我有我的部分标题如下

在这里输入图像说明

我检查了以下链接

重新加载ios7中的tableView标头

更改UITableView的部分页眉/页脚标题,而无需重新加载整个表格视图

你可以尝试这样的事情:

 UIView *headerVw = [YOURTABLEVIEW headerViewForSection:section]; [headerVw setNeedsDisplay]; [headerVw setNeedsLayout]; 

注意:

  • 为了处理特定的视图,你可以定义标签

希望它能为你工作。