Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 340
Delete My Account Avatar asked Dec 21 '16 17:12

Delete My Account


2 Answers

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

like image 141
Sivajee Battina Avatar answered Nov 13 '22 09:11

Sivajee Battina


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/

like image 4
Gurdev Singh Avatar answered Nov 13 '22 11:11

Gurdev Singh