我想在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
解决方法
你可以尝试这样的事情:
UIView *headerVw = [YOURTABLEVIEW headerViewForSection:section]; [headerVw setNeedsDisplay]; [headerVw setNeedsLayout];
注意:
>要处理特定视图,您还可以定义标签
希望它对你有用.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。