dequeueReusableCellWithIdentifie
2018-12-28 本文已影响7人
00d1ed2b53ae
区别
对于dequeueReusableCellWithIdentifier: forIndexPath,如果没有为复用id注册一个class 或者nib的话,程序会崩溃(crash);
对于dequeueReusableCellWithIdentifier,如果没有复用id注册class或者nib,程序会返回nil。
注册方式
registerClass:forCellReuseIdentifier:
registerNib:forCellReuseIdentifier
为什么需要forIndexPath
因为在返回cell之前,会调用委托ableView:heightForRowAtIndexPath来确定cell尺寸(如果已经定义该函数)