sam*_*max 7 iphone cocoa-touch objective-c cocoa-bindings ios
当我尝试通过UINib的instantiateWithOwner方法从xib文件加载自定义UITableViewCell时,我收到以下错误.我已经尝试了所有其他解决方案,我可以在这里找到没有运气.问题似乎是当Uibib打开xib文件时,它使用超类UITableViewCell而不是我的自定义类ContentPackCell.我附上了Interface Builder的截图,显示了我将xib与我的类相关联的位置以及关联标识符的位置.我必须要做一些其他的步骤.
错误:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewCell 0x6b87220> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key descriptionLabel.'
代码(类似于Apple的示例AdvancedTableViewCells项目):
ContentPackCell *cell = (ContentPackCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[self.cellNib instantiateWithOwner:self options:nil];
cell = tmpCell;
self.tmpCell = nil;
}
Run Code Online (Sandbox Code Playgroud)


更新:

看起来您已将笔尖中的 UILabel 与代码中不再存在的 IBOutlet 链接起来(descriptionLabel)。
所以再次检查你的 nib 文件。我也多次遇到此错误,这对我来说是解决方案。