TableViewCell的复用

作者: 海泉 | 来源:发表于2016-09-20 21:18 被阅读101次

    :滑动tableView,cell会添加到复用的cell上

    就像这样子 报错是这样子的

    初步判断,是cell的复用有问题,看了看,有这么个方法

    - (void)prepareForReuse;                                                        // if the cell is reusable (has a reuse identifier), this is called just before the cell is returned from the table view method dequeueReusableCellWithIdentifier:.  If you override, you MUST call super.

    在方法中把子视图移除,这方法不好。因为在view中创建了cell,其就不能是空

    这是现在的

    填坑方法:就是cell的复用问题,在复用的cell重复创建cell再赋值,取得复用cell后判断一下就好了。

    相关文章

      网友评论

        本文标题:TableViewCell的复用

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