Want a-z index on rhs of my UITableView

Discussion in 'iPhone/iPad Programming' started by beachdog, Aug 30, 2008.

  1. macrumors member

    Aug 10, 2008
    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?
  2. macrumors member

    Jul 28, 2008

    Your datasource should implement sectionIndexTitlesForTableView:
  3. macrumors regular

    Apr 4, 2007
    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:

Share This Page