Example of [NSDictionary getObjects:andKeys:] 的示范

NSDictionary*myDictionary =[NSDictionary dictionaryWithObjectsAndKeys:@"1",@"A",@"2",@"B", nil];NSInteger count =[myDictionary count];
id objects[count];
id keys[count];[myDictionary getObjects:objects andKeys:keys];for(int i =0; i < count; i++){
  id obj = objects[i];
  id key = keys[i];NSLog(@"%@ -> %@", obj, key);}

还有一个:
NSDictionary*myDictionary =[NSDictionary dictionaryWithObjectsAndKeys:@"1",@"A",@"2",@"B", nil];NSInteger count =[myDictionary count];
id __unsafe_unretained objects[count];
id __unsafe_unretained keys[count];[myDictionary getObjects:objects andKeys:keys];for(int i =0; i < count; i++){
  id obj = objects[i];
  id key = keys[i];NSLog(@"%@ -> %@", obj, key);}
posted @ 2013-09-09 15:20  duger  阅读(681)  评论(0编辑  收藏  举报