PDA

View Full Version : Want a-z index on rhs of my UITableView




beachdog
Aug 30, 2008, 02:37 PM
The UITableView reference says "A table view can have an index that appears as a bar on the right hand side of the table (for example, "a" through "z")", which is exactly what I want. But I don't see how to do it. Can someone offer some pointers on this?



Taum
Aug 30, 2008, 04:37 PM
Hi,

Your datasource should implement sectionIndexTitlesForTableView:

Garrett
Aug 31, 2008, 01:26 AM
The UITableView reference says "A table view can have an index that appears as a bar on the right hand side of the table (for example, "a" through "z")", which is exactly what I want. But I don't see how to do it. Can someone offer some pointers on this?

Here is the documentation from the UITableView.h file

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; // return list of section titles to display in section index view (e.g. "ABCD...Z#")
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index; // tell table which section corresponds to section title/index (e.g. "B",1))

You just simply give it an array of data (which you would use for your table anyways). I am not sure how to implement images though :rolleyes: