Want a-z index on rhs of my UITableView

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

  1. macrumors member

    Joined:
    Aug 10, 2008
    #1
    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

    Joined:
    Jul 28, 2008
    #2
    Hi,

    Your datasource should implement sectionIndexTitlesForTableView:
     
  3. macrumors regular

    Joined:
    Apr 4, 2007
    #3
    Here is the documentation from the UITableView.h file

    Code:
    - (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