【发布时间】:2014-07-21 02:21:42
【问题描述】:
此问题不应与此here. 混淆。这是两个不同的东西。
有一个good example 如何在 SO 上使用 UITableView Header。
这一切都很好,只要样式设置为plain,主标题就固定在顶部。
但如果我使用sections,则主标题不再停留在顶部并在滚动到底部时移开。
在这种方法中,我返回每个部分的标题。
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
在这种方法中,我正在为上面的标题部分设置高度:
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
在这个方法中,我设置的是真正的表头。
- (void)viewWillAppear:(BOOL)animated {
...
self.recordTableView.tableHeaderView = headerView;
}
在使用部分时甚至可以有一个固定的表头吗? 请问有什么替代解决方案?
【问题讨论】:
-
正如 OP 在开场白中所说,这不是同一个问题。
标签: ios uitableview