本文介绍了如何读取plist数据并从中获取int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前使用cocos2d。我有一个plist数据名称myplist.plist。
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 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
更多推荐
如何读取plist数据并从中获取int?
发布评论