Chris C
Chris C

Reputation: 271

Sorting and Grouping UITableView in alphabetical order

I have an array filled with items from MPMediaQuery and I am trying to figure out how to get each song sorted in alphabetical order in the tableview. How do I set up the table to show each section for each letter and fill each section with the songs. not sure what code would be relevant to post, but if you need, I will provide my code i have so far.

Upvotes: 0

Views: 851

Answers (1)

Luca D'Alberti
Luca D'Alberti

Reputation: 4859

You have to sort your array using a sort of NSSortDescriptor. Then you can create a different section for each letter. You also have to configure the tableviewcell properly. Surely this will be helpful for you: https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UITableViewDelegate_Protocol/index.html and https://developer.apple.com/LIBRARY/IOS/documentation/UIKit/Reference/UITableViewDataSource_Protocol/index.html

Upvotes: 2

Related Questions