ラベルにテキストを設定しようとしています。コードは次のとおりです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
newsDataCell *cell = (newsDataCell*)[tableView dequeueReusableCellWithIdentifier:@"newsData"];
if (cell == nil)
{
cell = [[newsDataCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"newsData"];
}
NSDictionary* currentrow =[self.Items objectAtIndex:indexPath.item];
NSLog(@"currentrow:%@",currentrow);
//UIImageView *image = (UIImageView*)[cell viewWithTag:0];
UILabel *txtData = (UILabel*)[cell viewWithTag:1];
NSString *testo = [currentrow objectForKey:@"Date"];
[txtData setText:testo];
UILabel *txtTitolo = (UILabel*)[cell viewWithTag:2];
txtTitolo.text =[currentrow valueForKey:@"Title"];
UILabel *txtDescrizione = (UILabel*)[cell viewWithTag:3];
txtDescrizione.text = [currentrow valueForKey:@"Descr"];
return cell;
}
チェックしたところ、現在の行には実際にオブジェクトが含まれています。これは、Xcode から取得したエラーです。
2013-09-11 16:04:36.468 ApplicationName[2409:c07] *** キャッチされない例外 'NSInvalidArgumentException' が原因でアプリを終了します。 throw call stack: (0x1333012 0x1158e7e 0x13be4bd 0x1322bbc 0x132294e 0xc5f4 0x1578fb 0x1579cf 0x1401bb 0x150b4b 0xed2dd 0x116c6b0 0x265bfc0 0x265033c 0x2650150 0x25ce0bc 0x25cf227 0x25cf8e2 0x12fbafe 0x12fba3d 0x12d97c2 0x12d8f44 0x12d8e1b 0x22757e3 0x2275668 0x9cffc 0x2c2d 0x2b55) libc++abi.dylib: terminate called throwing an exception
valueForKey を使用しても同じエラーが発生します。
txtTitolo.text =[currentrow valueForKey:@"Title"];
ここにあります:
2013-09-11 16:09:34.478 ApplicationName[2409:c07] *** キャッチされていない例外 'NSInvalidArgumentException' によりアプリを終了します。理由: '-[__NSArrayM valueForKey:]: 認識されないセレクターがインスタンス 0x7172f80 に送信されました' *** 最初throw call stack: (0x1333012 0x1158e7e 0x13be4bd 0x1322bbc 0x132294e 0xc5f4 0x1578fb 0x1579cf 0x1401bb 0x150b4b 0xed2dd 0x116c6b0 0x265bfc0 0x265033c 0x2650150 0x25ce0bc 0x25cf227 0x25cf8e2 0x12fbafe 0x12fba3d 0x12d97c2 0x12d8f44 0x12d8e1b 0x22757e3 0x2275668 0x9cffc 0x2c2d 0x2b55) libc++abi.dylib: terminate called throwing an exception
なにが問題ですか?