美文网首页
dequeueReusableCellWithIdentifie

dequeueReusableCellWithIdentifie

作者: 00d1ed2b53ae | 来源:发表于2018-12-28 15:35 被阅读7次

区别
对于dequeueReusableCellWithIdentifier: forIndexPath,如果没有为复用id注册一个class 或者nib的话,程序会崩溃(crash);

对于dequeueReusableCellWithIdentifier,如果没有复用id注册class或者nib,程序会返回nil。

注册方式
registerClass:forCellReuseIdentifier:
registerNib:forCellReuseIdentifier

为什么需要forIndexPath
因为在返回cell之前,会调用委托ableView:heightForRowAtIndexPath来确定cell尺寸(如果已经定义该函数)

相关文章

网友评论

      本文标题:dequeueReusableCellWithIdentifie

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