がキャッチされない例外により 'NSUnknownKeyException' にアプリを終了、 理由: '[setValueの:forUndefinedKey:]: このクラスは、キー値コーディング準拠のキー buttonOfFirstViewのためではありません。'NSUnknownKeyExceptionのsetValue:forUndefinedKey:
なぜこのエラーが発生しますか?私はXIBを使ってテーブルセルを作ろうとしています。このコードを追加すると、上記の例外がスローされます。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"MyCell";
MyTableViewCell *cell = (MyTableViewCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *arrayCellXib = [[NSBundle mainBundle] loadNibNamed:@"MyTableViewCell"
owner:self
options:nil];
....
}
.....
return cell;
}
解決方法を教えてください。
watはあなたのbuttonOfFirstViewですか? –
テーブルセル内のボタン IBOutlet UIButton buttonOfFirstView; – dayitv89
正しく接続されているか確認してください。 –