开发者

UITableView hide sectionindex but retain sections

开发者 https://www.devze.com 2022-12-25 23:22 出处:网络
We\'d like to implement our own section index UI for UITableView. It\'s clearly possible, since the contacts app does it on iPad开发者_运维百科. Is there a way of legally hiding the current section

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

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)


That answer helps.

The trick here is to have

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

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

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


Does the answer to this question help?:

Customizing Section indexes in UITableView in iphone application

0

精彩评论

暂无评论...
验证码 换一张
取 消