滚动时如何始终显示tableView单元格

时间:2016-01-02 14:35:44

标签: objective-c uitableview

我需要始终使用segmentControll显示单元格,我该怎么做?

a busy cat

a busy cat

a busy cat

1 个答案:

答案 0 :(得分:1)

有几种方法可以做到这一点。这就是我要做的。

1

不要将分段控件作为表格的一部分。只需将其移到UITableView外面即可。话虽如此,如果您使用的是TableView控制器,则必须切换到ViewController并向其添加TableView。

2

这是一种为表创建标题的方法。也许这就是你想要的。

如果您想要标题,请使用此方法:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

如果您想要自定义视图,请使用此选项:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

高度:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
相关问题