How do I sort an NSMutableArray with custom objects in it?

Posted by Rohit Kumar | Updated on

Want to sort an NSMutableArray with custom objects in it? Either you implement a compare-method for your object:

NSSortDescriptor (better)

You can easily sort by multiple keys by adding more than one to the array. Using custom comparator-methods is possible as well. Have a look at the documentation.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers