gab*_*m10 5 iphone objective-c ipad ios4
我正在尝试使用我在IB中构建的单元格来构建自定义表格视图.我收到一个奇怪的错误:
<BroadcastViewController 0x4b4f5f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key postText.
Run Code Online (Sandbox Code Playgroud)
一切都在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;
}
Run Code Online (Sandbox Code Playgroud)
以前有人见过这种错误吗?如果您需要更多信息,请告诉我......
真正奇怪的是,它抱怨该课程BroadcastViewController不符合KVC标准postText.
据我所知postText,你的单元格中有一个标签,因此IBOutlet应该在BroadcastTableViewCell课堂上.因此,请查看您postText在IB中链接标签的位置.此外,您可能在视图控制器中为此标签设置了一个IBOutlet,您已将其删除,但您忘记删除IB中的链接.无论如何,有一个地方是你的问题.您在该行上有错误的事实只是因为您在那里加载NIB,它与单元本身或与所有者没有任何关系.
| 归档时间: |
|
| 查看次数: |
1309 次 |
| 最近记录: |