美文网首页
TableViewCell重用报错

TableViewCell重用报错

作者: white_W | 来源:发表于2019-04-08 10:38 被阅读0次

2019-04-08 10:24:26.730650+0800 NucleusGene[72621:1459162] *** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.54.4/UITableView.m:7882

(lldb)

网上的资料说的是用不用ForIndexPath的区别,或者是签名没有注册Cell的失误。

仔细查看了一下,我在同一个层级下写了两个

[tableView dequeueReusableCellWithIdentifier:@"cell1" forIndexPath:indexPath];

[tableView dequeueReusableCellWithIdentifier:@"cell2" forIndexPath:indexPath];

相当于我对同一个indexPath 引用了两个 Identifier ,分别为@“cell1”,@“cell2”,从而导致的崩溃。

资料说用不用 forIndexPath 的区别应该就是因为给当前的indexPath分配了两个Identifier,而导致的冲突,如果我们不用indexPath,那Identifier就不会与 indexPath 绑定 ,而不会冲突。

相关文章

网友评论

      本文标题:TableViewCell重用报错

      本文链接:https://www.haomeiwen.com/subject/oatuiqtx.html