ios - 此类对于键 tradeTextField 不符合键值编码

标签 ios uitableview

我的应用程序有一个带有 PrototypeCells (CustomCells) 的 TableView。有 4 个部分,每个部分只有一行。前三个单元格是相同的,它们都有一个 UITextField (tradeTextField)。但是第四个单元格 (Class ResultCell) 在中间有一个自定义标签。在 InterfaceBuilder 中,我将 Prototype Cell 的数量设置为两个,并将 Basic Class 更改为 ResultCell,并将标识符更改为 resultCell。现在我收到了错误

this class is not key value coding-compliant for the key tradeTextField.'

这里是 cellForRowAtIndexPath 方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section == 3) //Here i'm getting the error
{
    ResultCell *cell = [tableView dequeueReusableCellWithIdentifier:@"resultCell" forIndexPath:indexPath];
    cell.resultLabel.text = @"Test";
    return cell;
}
else
{
    TradeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"tradeCell" forIndexPath:indexPath];
    return cell;
}   
}

谁能帮帮我?

最佳答案

尝试检查您的 Storyboard是否存在与 IBOulet 的不存在连接。如果您在代码中删除 socket ,来自 IB 的连接仍然存在。

关于ios - 此类对于键 tradeTextField 不符合键值编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22044454/

相关文章:

ios - 重用 UITableViewCell 后出错

iphone - UITableView 顶部和底部阴影

ios - 与 iOS 应用程序的 Flurry 集成导致链接错误

iphone - 使用 MaskToBounds NO 处理触摸事件

swift - 在 Swift 中插入行崩溃

ios - 显示 Tableview 的最后一个单元格

ios - UITableView 改变内容大小

objective-c - 发生viewdidappear后加载uitableview数据?

c# - xamarin 形式清除 session ios xamarin 形式

ios - 使用 GL_LINE_STRIP 绘制三角形轮廓时的奇怪顺序