I am trying to sort an array of NSDictionaries into an alphabatised array of arrays based of one of the NSDictionary valueForKey:
first letters
effectively I want something that looks a little something like this
Array A // contains NSDictionaies with keyvalue MAF strings starting with A
NSDictionary1
NSDictionary2
NSDictionary3
Array B // contains NSDictionaies with keyvalue MAF strings starting with B
NSDictionary1
NSDictionary2
NSDictionary3
Array C // contains NSDictionaies with keyvalue MAF strings starting with C
NSDictionary1
NSDictionary2
NSDictionary3
etc
So I have an array of Letters and inside each letter array I would like to have an Array of NSDictionary values that keyValue MAFs first letter should match.
So far I have an array of dictionaries that I have sorted like so
NSSortDescriptor *sortDescriptor;
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"MAF"
ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
sortedDictionaryArray = [arrayData sortedArrayUsingDescriptors:sortDescriptors]; // use this in cellforrow: and didselectrow:
NSLog(@"%@", sortedDictionaryArray); // this gives me a sorted array of NSdictionaries based off their MAF keyvalue.
This is what the NSDicitonary looks like
HADM = 1;
ISLOT = 0;
ISVERT = 0;
MAF = "Yazot"; // keyvalue I am trying to work with.
Then I get stuck, I am not sure where to go from here. if anyone could help me understand how to create an NSArray of NSArrays NSDictionaries that would be great! hopefully I have explained what I am trying to do correctly, if you need any more details just let me know and I will supply.