1.tableView中 重用xib创建的cell时报错(17-11-18)
错误
terminating with uncaught exception of type NSException
情景
- 首先是正常方式创建带xib的cell
略 - 然后正常注册:
[self.tableView registerNib:[UINib nibWithNibName:@"MCZHTableViewCell" bundle:nil] forCellReuseIdentifier:@"MCZHTableViewCell"];
- 最后正常的重用:
MCZHTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"MCZHTableViewCell" forIndexPath:indexPath];
一运行,就会在重用这里崩溃,崩溃原因就是:terminating with uncaught exception of type NSException
而且我在新的工程里面没事,就是在一个老项目中出现这个问题。
原因及解决
最后面发现这个项目是MRC和ARC混编的,所以在下图中的目录添加cell的xib文件即可解决
QQ20171118-110344@2x.png










网友评论