Reputation: 19418
I am parsing an XML and getting the details of members. In that I am getting the status code 0(offline) or 1(online) of member. I stored the this values into an NSMutableArray. Now I want to display first online members and then offline members.
How can I accomplish this ?
Thanks..
Upvotes: 0
Views: 280
Reputation: 605
Sorting array with using function:
NSArray *sortedArray = [dict.allKeys sortedArrayUsingFunction:alfabetSort context:NULL];
NSInteger alfabetSort(id num1, id num2, void *context)
{
return [num1 compare:num2];
}
Upvotes: 0
Reputation: 69499
Well you can use SortDescriptors to tell how you sorting will work. then just call:
[yourNSMutableArray sortedArrayUsingDescriptors:[NSArray arrayWithObject:yourSortDescriptor]];
Upvotes: 1