开发者

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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜