【发布时间】:2010-10-15 14:11:56
【问题描述】:
我正在尝试使用我在 IB 中构建的单元格构建自定义表格视图。我收到一个奇怪的错误:
<BroadcastViewController 0x4b4f5f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key postText.
IB 中的所有内容都已正确连接到单元控制器。不太清楚为什么会这样。
这就是我的 cellForRowAtIndexPath 的样子:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the folder object of interest
Broadcast *messageAtIndex = [self.messages objectAtIndex:indexPath.row] ;
static NSString *CellIdentifier = @"BroadcastTableViewCell";
static NSString *CellNib = @"BroadcastTableViewCell";
BroadcastTableViewCell *cell = (BroadcastTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
//ERRORING ON THIS LINE...
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil];
cell = (BroadcastTableViewCell *)[nib objectAtIndex:0];
}
cell.postText.text = messageAtIndex.replyText;
cell.authorName.text = messageAtIndex.postCreatorFirstName;
cell.postDate.text = messageAtIndex.creationDate;
return cell;
}
以前有人见过这种错误吗?如果您需要更多信息,请告诉我...
【问题讨论】:
-
需要cellForRowAtIndexPath函数的完整代码
-
看起来您正试图在不是 NSDictionary 的东西中插入“postText”的值? :)
-
事情是 postText 是一个字符串,它甚至没有打破那条线。我已经标记了上面导致错误的行。
标签: iphone objective-c ipad ios4