目前正在使用cocos2d。我有一个plist数据名称myplist.plist。 plist里面都是整数..我如何读取数据和int中的数据?
答案 0 :(得分:2)
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *dictionaryPath = [path stringbyAppendingPathComponent:@"myplist.plist"];
NSDictionary *integerDictionary = [[NSDictionary alloc] initWithContentsOfFile:dictionaryPath];
int myInteger1 = [[integerDictionary objectForKey:@"integer1"] intValue];
int myInteger2 = [[integerDictionary objectForKey:@"integer2"] intValue];
// etc etc