0

ストーリーボードに を追加したIBOutletところUIImageView、カスタムTableViewCellが機能しなくなりました。

2012-08-13 13:30:28.052 Project[6189:fb03] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<TableViewController 0x808ab80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imageView.'


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellIdentifier = @"CustomCell";
static NSString *CellNib = @"CustomCell";

CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil];
    cell = (CustomCell *)[nib objectAtIndex:0];
}
...
}

何かアドバイス?

4

1 に答える 1

1

これは私のアプリの外観です。ダイナミックプロトタイピングテーブルとカスタムセルを使用しています。

ss

私の絵コンテは以下のようなものです。

ss

ポイントは、画像ビューのタグを以下のように設定する必要があるということです。

ss

セル識別子をコードのセル識別子と同じに設定することを忘れないでください。そして、コードは以下のとおりです。

    UIImageView *imageView = (UIImageView *)[cell viewWithTag:5];
    imageView.image = [UIImage imageNamed:@"foo.jpg"];
于 2012-08-13T12:19:34.880 に答える