UITableViewCell错误

编程入门 行业动态 更新时间:2024-10-05 19:18:27
本文介绍了UITableViewCell错误 - 此类不是键值编码兼容的键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我尝试通过UINib的instantiateWithOwner方法从xib文件加载自定义UITableViewCell时,我收到以下错误。我试过所有其他解决方案,我可以找到在这里没有运气。问题似乎是,当xib文件由UINib打开时,它使用超类UITableViewCell而不是我的自定义类ContentPackCell。我附上一个来自Interface Builder的屏幕截图,显示了我将xib与我的类关联以及关联标识符的位置。

I'm getting the following error when I try to load a custom UITableViewCell from a xib file via UINib's instantiateWithOwner method. I've tried all of the other solutions I can find on here with no luck. The issue seems to be that when the xib file is opened up by UINib, it uses the super class UITableViewCell instead of my custom class, ContentPackCell. I have attached a screenshot from Interface Builder showing where I associated the xib with my class as well associating an Identifier. There has to be some other step that I'm missing.

错误:

***由于未捕获异常NSUnknownKeyException终止应用程序,原因:'[< UITableViewCell 0x6b87220> setValue:forUndefinedKey:]:这个类不是键值编码符合的key descriptionLabel。'

AdvancedTableViewCells项目):

The code (similar to Apple's sample AdvancedTableViewCells project):

ContentPackCell *cell = (ContentPackCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { [self.cellNib instantiateWithOwner:self options:nil]; cell = tmpCell; self.tmpCell = nil; }

更新:

推荐答案

确保nib中的文件所有者设置为NSObject,并确保没有插座连接到文件所有者。

Make sure that File's Owner in the nib is set to NSObject and also make sure that there are no outlets wired up to File's Owner.

更多推荐

UITableViewCell错误

本文发布于:2023-11-26 19:01:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634803.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   UITableViewCell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!