Hash of an array in objective-c, how?
2 answers
NSDictionary * highScores = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:[NSNumber numberWithInt:1], [NSNumber numberWithInt:1000], nil], @"John",
[NSArray arrayWithObjects:[NSNumber numberWithInt:2], [NSNumber numberWithInt:8000], nil], @"Mary",
[NSArray arrayWithObjects:[NSNumber numberWithInt:5], [NSNumber numberWithInt:2000], nil], @"Bob", nil];
NSLog(@"%@", [[highScores objectForKey:@"Mary"] objectAtIndex:1]);
+3
a source to share
You are looking for a data structure called map / associative array .
Take a look at this question: Hash tables in Cocoa
+1
a source to share