读取plist文件
- //取得mainBundle
- NSBundle *bundle = [NSBundle mainBundle];
- //取得文件路径
- NSString *plistPath = [bundle pathForResource:@"文件名" ofType:@"plist"];
- //也可以写成
- NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"文件名" ofType:@"plist"];
- //读取到一个NSDictionary
- NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
- //读取到一个NSArray
- NSArray *array = [[NSArray alloc] initWithContentsOfFile:plistPath];
posted on 2011-11-01 10:54 tongdengquan 阅读(129) 评论(0) 编辑 收藏 举报