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?
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?
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.
Yes. Implement the -sectionIndexTitlesForTableView:
method in the data source.
See the TableViewSuite example code for how to use it.
Have a look at the UITableViewDataSource documentation. There's a method sectionIndexTitlesForTableView:
and tableView:sectionForSectionIndexTitle:atIndex:
. These should get you going.
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: