Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView hide sectionindex but retain sections

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)

like image 851
Dan Bennett Avatar asked Apr 05 '10 22:04

Dan Bennett


2 Answers

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.

like image 70
Dan Bennett Avatar answered Jan 02 '23 20:01

Dan Bennett


Does the answer to this question help?:

Customizing Section indexes in UITableView in iphone application

like image 32
prendio2 Avatar answered Jan 02 '23 20:01

prendio2