【发布时间】:2018-09-27 08:03:24
【问题描述】:
viewForHeaderInSection 没有在 reloadData 上被调用。加载视图时如何第一次调用它。很奇怪。有什么帮助吗?我已经实现了以下委托方法。
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 0;
}
-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section
{
return 1500.0f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return UITableViewAutomaticDimension;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {}
【问题讨论】:
-
tableView outlet、delegate和datasource也正确连接。
-
使用该代码编辑您的问题并对其进行格式化以及附加信息。它在 cmets 中不是真正可读的,并且在它是重要信息时可能会被遗漏。
-
我已经编辑了问题,请检查。
-
请显示此代码的更多上下文。
-
对我来说工作正常,也许问题出在你代码的其他部分。
标签: ios objective-c uitableview uitableviewsectionheader