如何使一个普通的UITableView的表头滚动 [英] How to make header of a plain UITableView Scroll with the table
问题描述
我想知道是否有任何方法允许普通表的tableview标题与表一起滚动?
I was wondering if there was any way to allow the tableview header of a plain table to scroll with the table?
我目前使用以下方法添加(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
<$ p
$ b
I am currently using the following method to add my header.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
推荐答案
实际上 tableHeaderView
与表滚动。节标题视图不是这种情况。如果您只有一个部分,那么您可以将标题视图设为 tableHeaderView
。
Actually the tableHeaderView
scrolls with table. This is not the case for section header views. If you have only one section then you can have the header view as tableHeaderView
.
table.tableHeaderView = aUiView;
如果您有多个部分,且所有部分都有自己的标题视图,则您没有而不是离开标题视图以自己的方式行事。或者,您可以通过使/配置/自定义每个部分的第一行看起来像标题视图并删除实际的部分标题视图来模仿标题视图。
If you have more than one sections and all of them have their own header views, then you have no choice than leaving the header views behave in their own ways. Or, you can imitate the header view by making/configuring/customizing the first row of each section look like header view and remove the actual section header views.
这篇关于如何使一个普通的UITableView的表头滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!