当我尝试通过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错误
发布评论