【发布时间】:2015-10-19 23:25:37
【问题描述】:
我想重新加载 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
【问题讨论】:
-
你改变了 secton 的高度
-
nopes 高度是恒定的
-
试试这个链接会很有用stackoverflow.com/questions/23501952/…
-
它不起作用,伙计
标签: ios objective-c uitableview