UITableView:viewForHeaderInSection:在reloadData期间未调用: [英] UITableView : viewForHeaderInSection: not called during reloadData:
问题描述
我已经使用正确的委托和数据源链接设置了tableview .. reloadData方法调用了数据源和委托方法,但 viewForHeaderInSection:
除外。
I've set up the tableview with correct delegate and datasource linkages.. the reloadData method calls the datasource and the delegate methods except for viewForHeaderInSection:
.
为什么会这样?
推荐答案
使用 tableView:viewForHeaderInSection:
要求你也实施的tableView:heightForHeaderInSection:
。这应该为标题返回适当的非零高度。另外,请确保您没有实现 tableView:titleForHeaderInSection:
。你应该只使用一个或另一个( viewForHeader
或 titleForHeader
)。
The use of tableView:viewForHeaderInSection:
requires that you also implement tableView:heightForHeaderInSection:
. This should return an appropriate non-zero height for the header. Also make sure you do not also implement the tableView:titleForHeaderInSection:
. You should only use one or the other (viewForHeader
or titleForHeader
).
这篇关于UITableView:viewForHeaderInSection:在reloadData期间未调用:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!