I have NSDictionaries stored in an NSMutableArray. Each NSDictionary has a NSNumber inside of it. So right now, my tableview will show the cells in the way they are ordered in the array. What I want to do is reorder the cells from highest NSNumber to lowest NSNumber, so how would I do this with all the NSDictionaries in the NSMutableArray. I will probably need a for loop or something like that but I am not sure how to do it.
Also I have NSDate’s (non-formatted) in my NSDictionaries, so how would I sort the NSDictionaries based upon the newest dates inside them?
Thanks!
You need to use the
sortedArrayUsingSelectormethod of NSMutableArray and provide a sorting function, like this:I didn’t tested this but that’s the idea.