终止应用程序,原因是:“setValue:forUndefinedKey:该类不符合键buttonOfFirstView的键值编码。”
为什么我会有这个错误?我正试图通过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;
}如何解决这个问题?
发布于 2012-05-31 06:42:09
检查XIB中对您的网点的引用,其中之一可能是引用一个不再存在的属性(buttonOfFirstView)。
发布于 2014-10-04 19:48:21
在XIB中将文件的所有者类设置为NSObject,将UITableViewCell类设置为自定义类。它将解决这个问题。
发布于 2012-05-31 06:42:47
这正是一个与您的buttonOfFirstView中的键case.If有关的问题,它是一个按钮,它可能在任意一个xib中被错误连接。
https://stackoverflow.com/questions/10828608
复制相似问题