开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜