zlog zlog - 14 days ago 5
iOS Question

Is it possible to create an index other than A-Z in an iphone table view?

Is it possible to create an index (using UILocalizedIndexedCollation or otherwise) other than A-Z for a table view, e.g., change the A-Z vertical bar on the right of a table view to 1st, 2nd, 3rd.

Answer

Yes it is possible..

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

is method where you declaring what to show on the section index. i.e. on the right of the table.

and

- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index

is the method where you handling touch events.. so you can match with the section title you have given in first method and use it to make decisions.

Comments