美文网首页
关于cell复用的问题

关于cell复用的问题

作者: 玉门山海关 | 来源:发表于2018-11-21 17:28 被阅读0次

cell复用是一个很常见的问题,就如下设置是会造成复用的:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];

正确的方式应该是:

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

        if(!cell){

           cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault                 reuseIdentifier:cellID];

        }

相关文章

网友评论

      本文标题:关于cell复用的问题

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