Possible Duplicate:
How to sort an NSMutableArray with custom objects in it?
I have a custom class where one of the values are names. Imagine the class is called Person. I would like to sort these values, which I am keeping in an NSMutableArray according to the name variable, however:
[testarray sortUsingSelector:@selector(compare:)];
will only work only an array of strings.
I am trying to work out how I can arrange the array alphabetically given that:
Person *person;
person = [array objectAtIndex:0];
[person name];
Person *person;
person = [array objectAtIndex:1];
[person name];
How can I compare the two? Thanks!