-3

に 2 つのラベルを持つストーリーボードがありUITableViewCellます。

タイトルと価格。

私のViewController.m中には、データを含む配列があります(JSONのURLから)。必要なものはすべて取得できますが、このデータをラベルに追加したい場合は、次のようなことを試しました:

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellIdentifier = @"BasicCell"; UITableViewCell *myCell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    // 表示する位置を取得 Location *item = _feedItems[indexPath.row]; NSString *baseUrl = @"アドレス/宛先/画像"; NSString *urlString = [baseUrl stringByAppendingString:item.thumbnail]; NSURL *urla = [NSURL URLWithString:urlString]; NSData * imageData = [NSData dataWithContentsOfURL:urla]; UIImage * image = [UIImage imageWithData:imageData];

    myCell.imageView.image = 画像;

    myCell.detailTextLabel.text = item.elementid; // "No visible @interface for 'Location' はセレクター 'objectAtIndex:' を宣言します myCell.textLabel.text = item.element; //"No visible @interface for 'Location' はセレクター 'objectAtIndex:' を宣言します

    myCell を返します。}

うまくいかず、その理由がわかりません。エラーメッセージは表示されませんでした。誰でも私を助けることができますか?

4

1 に答える 1

2

indexPath.row のラベルに配列テキストを追加する必要があります。

myCell.detailTextLabel.text = [item objectAtIndex:indexPath.row];
myCell.textLabel.text = [item objectAtIndex:indexPath.row];
于 2014-10-07T12:42:53.010 に答える