Here is a way to sort an array of an object
NSSortDescriptor * descFirstname = [[NSSortDescriptor alloc] initWithKey:@"firstname" ascending:YES]; NSSortDescriptor * descLastname = [[NSSortDescriptor alloc] initWithKey:@"lastname" ascending:YES]; [myArrayOfPerson sortUsingDescriptors:[NSArray arrayWithObjects:descLastname,descFirstname, nil]]; [descFirstname release]; [descLastname release];
source share