tags:

views:

127

answers:

3

Hello everyone,

i have one problem when i sort the NSMutablearray using date and time wise.

Does anyone have idea how can i sorted array date and time wise

Thanks in advance

+3  A: 

The NSArray/NSMutableArray classes contain a method...

- (void)sortUsingSelector:(SEL)comparator

Which you can call passing in the following selector...

@selector(compare:)

This uses the NSDate classes compare method to perform the sorting. An alternative would be to create a NSSortDescriptor object and pass it to the NSMutableArray's sortUsingDescriptors method.

mmccomb
A: 

Thanks you very much for quick reply.

milanjansari
very funny. But this is not a forum site - remember.
sugar
Thank them by "accepting" their answer.
Jann
A: 

Here is the date format 04/13/2010 which get in xml file...

NSSortDescriptor *filter = [[NSSortDescriptor alloc] initWithKey:@"dateTime" ascending:FALSE];

    [appDelegate.arrayWYWOMessage sortUsingDescriptors:[NSArray arrayWithObject:filter]];

but same problem, i am not getting perfect list

can you have any sample code.

milanjansari
[appDelegate.arrayWYWOMessage sortUsingSelector:@selector(compare:)];
mmccomb