I have three arrays
. They are name, birthdates and remaining days like below:
name birthdate remaining
"Abhi Shah", "01/14", 300
"Akash Parikh", "12/09/1989", 264
"Anand Kapadiya", "12/01", 256
"Annabella Faith Perez", "03/02", 347
"Aysu Can", "04/14/1992", 25
"Chirag Pandya" "10/07/1987" 201
I want to rearrange the remaining days array
into ascending order,
but at the same time name and birthdate should also get reordered in the same way.
See this example below:
name birthdate remaining
"Aysu Can", "04/14/1992", 25
"Chirag Pandya" "10/07/1987" 201
"etc..."
such as your
MutableArray
is aDictionarys array
, you can usesortUsingComparator
to sort the arrayFor example , I have a test :
then the output is :
Put each row into a dictionary, and out those dictionaries into an array. Then sort your away using a predicate or sort block. If you want an array containing just the sorted names for example, you could use
[ array valueForKeyPath:@"name" ]
Array looks like:
Use this in tableView listing
use
NSMutableDictionary
to store data toNSMutableArray
here after you arrange name array,use search option to use name not use index and use
NSPredicate
search data inNSMutableArray
once try like this it'l help you,