我想在viewForHeaderInSection中自定义单元格的情况下重新加载viewForHeaderInSection以重新加载特定的viewForHeaderInSection
IOS.
我使用了以下代码
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation: UITableViewRowAnimationAutomatic];
但整个部分将重新加载
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]; }
但它不会重新加载该部分.
我检查了以下链接
Reloading tableView header in ios7
Changing UITableView’s section header/footer title without reloading the whole table view