Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone UITableView. How do turn on the single letter alphabetical list like the Music App?

In the iPhone music app, selecting Artist, Songs, or Albums presents a tableView with a verticl list of single letters at the righthand side of the UI that enables rapid scrolling. How do I enable this functionality in my app?

Cheers, Doug

like image 331
dugla Avatar asked Oct 31 '09 18:10

dugla


People also ask

What is Tableview?

A table view displays a single column of vertically scrolling content, divided into rows and sections. Each row of a table displays a single piece of information related to your app. Sections let you group related rows together. For example, the Contacts app uses a table to display the names of the user's contacts.

What is Tableview in Swift iOS?

Overview. Table views in iOS display rows of vertically scrolling content in a single column. Each row in the table contains one piece of your app's content. For example, the Contacts app displays the name of each contact in a separate row, and the main page of the Settings app displays the available groups of settings ...

What class does UITableView inherit from?

The tableview is the instance of the UITableView class, which inherits the UIScrollView class.


1 Answers

Supply your own index characters:

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {     return[NSArray arrayWithObjects:@"a", @"e", @"i", @"m", @"p", nil]; } 

and then:

- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString     *)title atIndex:(NSInteger)index {         return <yourSectionIndexForTheSectionForSectionIndexTitle >; } 

You will need sections.

like image 166
zaph Avatar answered Sep 22 '22 06:09

zaph