I am working for UIImage storing to NSMutableArray. How i can sort it with the UIImage because it's not storing any parameter or for-key by which i can sort using any comparator code.
I am working to store UIImage from image picker controller. After storing numbers of images to NSMutableArray. After that i need to sort My mutable to Last In First out(LIFO). It's currently working as First In First Out(FIFO) or descending. We are storing images to array as follow:
NSMutableArray *images = [NSMutableArray arrayWithCapacity:[info count]];
for (NSDictionary *dict in info) {
UIImage *image = [dict objectForKey:UIImagePickerControllerOriginalImage];
[images addObject:image];
}
[_currentData addObjectsFromArray:images];
After Storing i am not able to Sort Last added object to First display in image view. Following code Crashes for me:
NSSortDescriptor *desc = [NSSortDescriptor sortDescriptorWithKey:@"" ascending:NO];
[_currentData sortUsingDescriptors:@[desc]];
My _currentData is main NSMutableArray which i am using to display in the table view after shorting.
Please help me For sorting UIImage stored NSMutableArray for LAST IN FIRST OUT(LIFO) descending order.