UITableView隐藏sectionindex但保留节 [英] UITableView hide sectionindex but retain sections

查看:190
本文介绍了UITableView隐藏sectionindex但保留节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想为UITableView实现我们自己的节索引UI。

We'd like to implement our own section index UI for UITableView.

这是显而易见的,因为联系人应用程序在iPad上。有没有法律隐藏当前部分索引的方法? (我可以得到未记录的_index UIView,但这不会削减它与苹果我怀疑)

It's clearly possible, since the contacts app does it on iPad. Is there a way of legally hiding the current section index? (I can get to the undocumented _index UIView but that's not going to cut it with Apple I suspect)

推荐答案

这里的诀窍是具有

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView;

返回nil,同时保留其他基于数据源方法的实现:

return nil, while keeping implementations for the other section based data source methods:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

这似乎说服了tableview不显示节索引,但仍允许通过索引导航。

That seems to convince the tableview not to display a section index, but still allow navigation by index.

这篇关于UITableView隐藏sectionindex但保留节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆