views:

97

answers:

1

Hello All I need to sort an NSMutable Array that having a class Objects say Item . Item class have date,url,link,title,guid etc .. I am storing this Object Into an NsMutableArray each time. so MyArray will have number Of Item class Objects .. now I need to sort Myarray using date attribute . Can any one tell me the way. Thanks

+1  A: 
NSSortDescriptor *descriptor = [NSSortDescriptor withKey:@"date" ascending:YES]; // or NO, if you want descending

[yourMutableArray sortUsingDescriptors:[NSArray arrayWithObject:descriptor]];
Wevah
Thanks alot for a very quick response.. I did the same kind of work like [array sortUsingDescriptor:descriptor]; but its giving an exception ...
ratnasomu