开发者

Sort List Based On Custom User Settings

开发者 https://www.devze.com 2023-01-25 06:04 出处:网络
I\'m working on an app where a user can upload and download information.The information is downloaded in such a way that when it\'s downloaded, it\'s ordered according to when it was su开发者_开发技巧

I'm working on an app where a user can upload and download information. The information is downloaded in such a way that when it's downloaded, it's ordered according to when it was su开发者_开发技巧bmitted.

What I'd like is for the user to be able to reorganize the table view, save the order to a preference file (all ready working) and from now on, whenever data is request, the order now conforms to the users re-organized list.

Maybe my brains just fried, but is there an array function that can accomplish this, or am I on my own? Any suggestions how to go about writing something like this?

Thanks


What about NSSortDescriptor:

NSArray *sortedArray = [originalArray sortedArrayUsingDescriptors:
                            [NSArray arrayWithObject:
                             [[[NSSortDescriptor alloc] initWithKey:@"keyToBeSorted"
                                                          ascending:YES
                                                           selector:@selector(localizedCaseInsensitiveCompare:)] autorelease]]];
0

精彩评论

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