Reputation: 1047
this is my first question here..
I have a tableview setting with numberOfSectionsInTableView=6, which has also custom created cells. I am trying to use 'section index title' with some predefined titles . I have gone through sample code and following the same. I'm able to show section index title from my tableview by using function 'sectionIndexTitlesForTableView'. But to activate that, i don't know how to make it work when i clicked on some title. Let me want to move to the page based on title selection. For example, same like how built-in Contacts(address book) works.
I'm on MAC OS X 10.7 lion (beta) using XCode 4.2 iOS SDK 5.0
Upvotes: 0
Views: 2639
Reputation: 35394
You have to implement tableView:sectionForSectionIndexTitle:atIndex:
!
This method is passed the index number and title of an entry in the section index list and should return the index of the referenced section. To be clear, there are two index numbers in play here: an index to an section index title in the array returned by sectionIndexTitlesForTableView:, and an index to a section of the table view; the former is passed in, and the latter is returned. You implement this method only for table views with a section index list—which can only be table views created in the plain style (UITableViewStylePlain). Note that the array of section titles returned by sectionIndexTitlesForTableView: can have fewer items than the actual number of sections in the table view.
Upvotes: 1