Vijay
Vijay

Reputation: 201

Arrange tableview data in alphabetical order in sections

I have a list of data in array.

I implemented code to display the data from that array in table view.

Displays normally Now I need to display data as follows in alphabetical order and sections.

How can I achieve this?

Upvotes: 0

Views: 2035

Answers (1)

Abhishek Singh
Abhishek Singh

Reputation: 6166

Sort USing:-

NSSortDescriptor *sortParam= [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES];
[yourArray sortUsingDescriptors:[NSArray arrayWithObject:sortParam]];

Sort it in viewdidload before assigning it to table.

Upvotes: 1

Related Questions