开发者

How to read a plist data and get int from it?

开发者 https://www.devze.com 2023-02-11 14:22 出处:网络
Currently using cocos2d. I have a plist data name myplist.plist. Inside the plist are all integers.. How do i read the data and the int in 开发者_JAVA百科it?NSString *path = [[NSBundle mainBundle] bun

Currently using cocos2d. I have a plist data name myplist.plist. Inside the plist are all integers.. How do i read the data and the int in 开发者_JAVA百科it?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消