當我試圖解析一些奇怪的事情。解析.plist項目
我指望我的項目與
NSString *bundlePathofPlist = [[NSBundle mainBundle]pathForResource:@"Mything" ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:bundlePathofPlist];
NSArray *dataFromPlist = [dict valueForKey:@"some"];
NSMutableArray *data = [NSMutableArray array];
for(int i =0;i<[dataFromPlist count];i++)
{
//NSLog(@"%@",[dataFromPlist objectAtIndex:i]);
[data addObject:[NSNumber numberWithInt:[dataFromPlist count]]];
}
[self setTableData:data];
NSLog(@"%@", tableData);
然後:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [tableData count];
}
這個偉大的工程,但隨後在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
我試圖
NSString *bundlePathofPlist = [[NSBundle mainBundle]pathForResource:@"Mything" ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:bundlePathofPlist];
NSArray *dataFromPlist = [dict valueForKey:@"some"];
NSLog(@"%@", dataFromPlist);
cell.Data.text = [NSString stringWithFormat:@"%@", dataFromPlist];
return cell;
但輸出是:
2012-08-13 23:08:48.130 [30278:707] (
Yeah,
Trol,
LOL,
)
而且在我的TableCell也顯示爲
(
Yeah,
Trol,
LOL,
)
什麼奇怪? – 2012-08-13 21:17:59
'( 呀, TROL,LOL , )'在一個小區就需要顯示在每一個單元@ H2CO3 – Frenck 2012-08-13 21:20:42