0
int number = 3;
NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
@"Apple",[NSNumber numberWithInt:0],
@"Peach",[NSNumber numberWithInt:1],
@"Lemon",[NSNumber numberWithInt:2],
@"Pineapple",[NSNumber numberWithInt:3],
........................,
nil];
NSString *numberToKey = [dict objectForKey:number];
如何在字符串中插入基于int数的字典值?基于int数的密钥对象
给予好评。你不能在需要指针类型对象的地方传入int,因为它会认为int是指针本身;使用[NSNumber]是要走的路。 – Tim