views:

248

answers:

4

I would like to create a custom contact list in my app offering a similar A-Z jump list like the standard contact list does.

Is this possible with a TableView?

+2  A: 

Absolutely, just return an array of NSStrings from the UITableViewDataSource method -sectionIndexTitlesForTableView

For the record, this "jump list" is called a section index.

You also need to correspond this with the actual amount of sections that you have, if not, then you can use tableView:sectionForSectionIndexTitle: to play around with which sections get shown for which indexes.

The docs, my friend, read the docs.

Jacob Relkin
I think your split personality is having problems again!
tigermain
+2  A: 

Yes. Implement the -sectionIndexTitlesForTableView: method in the data source.

See the TableViewSuite example code for how to use it.

KennyTM
+2  A: 

Have a look at the UITableViewDataSource documentation. There's a method sectionIndexTitlesForTableView: and tableView:sectionForSectionIndexTitle:atIndex:. These should get you going.

stigi
+5  A: 

There is a comprehensive tutorial on how to do it in the "Table View Programming Guide", called "Populating an Indexed List".

Moreover, if you also need to have the search functionality (the magnify icon), there are two well written solutions:

Laurent Etiemble