Delete My Account
Delete My Account

Reputation: 785

How to put alphabetical index on right side of a UITableview

I'm using Xcode 8 and Swift 3. I would like to create a dynamic UITableView to hold customer names with an alphabetical index letters or tabs on the right side for quick navigation.

I have found info on how to create the dynamic UITableView, so I'm good there, but haven't found any info on how to the alphabetical indexing.

Could someone please provide some information on how to do the indexing on a UITableView?

Upvotes: 19

Views: 23074

Answers (2)

Sivajee Battina
Sivajee Battina

Reputation: 4174

There is a delegate method for UITableview to do this job.

override func sectionIndexTitlesForTableView(tableView: UITableView) -> [AnyObject]! { return indexTitlesArray }

This is the method that shows indexTitlesForTableView. return indexTitles from this method.

Here is the link for more info: Section index titles for tableView

Upvotes: 29

Gurdev Singh
Gurdev Singh

Reputation: 2165

You need to implement the delegate method sectionIndexTitlesForTableView. This method is used to add quick jump navigation feature with UITableView.

You can refer this article.

https://www.appcoda.com/ios-programming-index-list-uitableview/

Upvotes: 4

Related Questions