I'm having a two dimensional array as follows
NSArray *cities = [NSArray arrayWithObjects:@"New Delhi",@"Karachi",@"Dhaka",@"Columbu", nil];
NSArray *distance = [NSArray arrayWithObjects:@"500",@"1400",@"1200",@"2800", nil];
NSMutableArray *details= [[NSMutableArray alloc]initWithCapacity:cities.count];
[details addObject:cities];
[details addObject:distance];
Now, the details
array looks like
(
(
"New Delhi",
Karachi,
Dhaka,
Columbu
),
(
500,
1400,
1200,
2800
)
)
I need to sort the array with ascending order w.r.t distance
array
ie,
(
(
"New Delhi",
Dhaka,
Karachi,
Columbu
),
(
500,
1200,
1400,
2800
)
)
how to do this?
I also need to sort the whole array by alphabetical order w.r.t cities
array.
I tried using sortUsingComparator
but, can't get the solution completely.
Any help would be appreciated.