I am new to iphone development.I am sorting a mutable array with respect to date.But it is sorting Using the date parameter consider it as string.I want to sort it by date.How can i achieve that .Please help me out.
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:YES];
[stories sortUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];
Can i use selectors? if so how should i use it?.Thanks.
after that you can sort the array just using the way you wrote in question.
Is the pubDate property of the objects in your array NSStrings or NSDates? I use that exact code on an array of objects with NSDates and it works perfectly fine. If you're using NSStrings you'll want to first convert them to date objects so you can properly sort by date.