UITableView sorting by rank
I have got an plist with an object it is a number开发者_C百科 with rank. I want to sort by the value of the float. From the biggest number to the lowest. And I dont know how to write the function.
Thank you
You should sort the array you get from your plist by the rank
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"your rank key"
ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
[yourArray sortedArrayUsingDescriptors:sortDescriptors];
[sortDescriptor release];
Do it before you pass the array to the TableView
Good luck
Try this it might help you..
use NSSortDescriptor for sorting the values for acending or decending..
精彩评论