dequeueReusableCellWithIdentifier:和dequeueReusableCellWithIdentifier: forIndexPath:的问题

来源:互联网 发布:淘宝联盟推广链接图片 编辑:程序博客网 时间:2024/04/26 11:14

1.dequeueReusableCellWithIdentifier:可以注册cell,也可以用if判断创建cell。对于使用if判断时,如果缓存池中有可重用的cell时,不会执行if判断,如果缓存池没有可重用的cell,执行if中的方法,但是有可能会覆盖上storyboard中的cell样式。


2.dequeueReusableCellWithIdentifier:  forIndexPath:  必须和注册cell 一起用。一般用个方法,如果没有注册cell会报错:eason: 'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'


0 0
原创粉丝点击