Uitableview .plist数据无法从NSArray加载到NSDictionary
我对Objective-C相当陌生 我已经在.plist上创建了所有存储在Uitableview .plist数据无法从NSArray加载到NSDictionary,uitableview,nsarray,plist,nsdictionary,Uitableview,Nsarray,Plist,Nsdictionary,我对Objective-C相当陌生 我已经在.plist上创建了所有存储在Response字典中的数据 NSString *myListPath = [[NSBundle mainBundle] pathForResource:@"OffersList" ofType:@"plist"]; dic = [NSDictionary dictionaryWithContentsOfFile:myListPath]; tableData = [dic objectForKey:@"Response"]
Response
字典中的数据
NSString *myListPath = [[NSBundle mainBundle] pathForResource:@"OffersList" ofType:@"plist"];
dic = [NSDictionary dictionaryWithContentsOfFile:myListPath];
tableData = [dic objectForKey:@"Response"];
NSDictionary *dict = [tableData objectAtIndex:indexPath.row];
cell.titleLabel.text = [dict objectForKey:@"title"];
cell.nowLabel.text = [dict objectForKey:@"price"];
cell.saveLabel.text = [dict objectForKey:@"rondel"];
现在我已经将tabledata
转换为Dictionary
NSString *myListPath = [[NSBundle mainBundle] pathForResource:@"OffersList" ofType:@"plist"];
dic = [NSDictionary dictionaryWithContentsOfFile:myListPath];
tableData = [dic objectForKey:@"Response"];
NSDictionary *dict = [tableData objectAtIndex:indexPath.row];
cell.titleLabel.text = [dict objectForKey:@"title"];
cell.nowLabel.text = [dict objectForKey:@"price"];
cell.saveLabel.text = [dict objectForKey:@"rondel"];
现在,问题是它只加载前10个数据。
我也尝试在日志中打印,但在第10个数据之后,它的值被视为
NULL
尝试转储整个dic
,以便您可以准确检查它包含的数据:
NSLog(@"Content of tableData", [dic description]);
然后用.plist内容仔细检查
tableData
元素的日志内容。我已经尝试过了,但正如我告诉你的,在整个tableview都是空单元格之后,它只加载10个数据。你确定你的plist是正确的吗?您能检查并确保第11个元素是正确的吗?你们能试着删除它吗?是的,我在这里提问之前检查过。我还试着删除第11项。但是没有结果
我马上就要解决问题了。我正在做的是尝试更改小的tableview大小。我只得到了前三个数据。在这之后,日志中的所有值都为空。有什么想法
怎么做?