Friday, 16 August 2013

How can i alphabetically sort the values in my NSDictionary with an NSArray?

How can i alphabetically sort the values in my NSDictionary with an NSArray?

I have an NSDictionary witch contains several arrays with several strings
in them. I want to put all strings under each array in one single array.
How can i receive all the strings at once? I´ve tried this:
NSMutableArray *mutarr = [[NSMutableArray alloc]
initWithObjects:[self.firstTableView allValues], nil];
NSArray *mySorted = [[NSArray alloc]init];
mySorted = [mutarr
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSLog(@"First table view values: %@", mySorted);
NOTE: self.firsttableview is a NSDictionary like this:
NSString *path = [[NSBundle mainBundle] pathForResource:@"firstTableView"
ofType:@"plist"];
self.firstTableView = [NSDictionary dictionaryWithContentsOfFile:path];
EFFECT: This gives me a list in NSLog, but it isnt in alphabetic order...
Please help.

No comments:

Post a Comment