You can sort an array with respect to another easily by adding them to an NSDictionary and do as follows:
// Put the two arrays into a dictionary as keys and values
NSDictionary *dictionary = [NSDictionary
dictionaryWithObjects:secondArray forKeys:firstArray];
// Sort the first array
NSArray *sortedFirstArray = [[dictionary allKeys]
sortedArrayUsingSelector:@selector(compare:)];
// Sort the second array based on the sorted first array
NSArray *sortedSecondArray = [dictionary objectsForKeys:sortedFirstArray
notFoundMarker:[NSNull null]];