0

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

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.