(自:)
不知道怎么回事,我用数组nsarray的方法来读写一直不行,后来听群里牛人说plist文件归根结底是个字典dic,所以我用了字典的方法来读写,结果成功了,先记着吧,免得以后又折腾,今天就折腾了好长时间:(注意:是得两个字典指针)
NSString *path = [[NSBundle mainBundle] pathForResource:@"customInfo" ofType:@"plist"];
NSDictionary *contentList = [[NSDictionary alloc]initWithContentsOfFile:path];
NSDictionary *tmpInfo = [contentList objectForKey: [NSString stringWithFormat:@"Item %d",indexPath.row]];
用的时候就像这样:
[[cell textLabel]setText:[tmpInfo objectForKey:@"title"]];
再发个我的plist文件截图吧: