美文网首页
UITableView dequeueReusableCellW

UITableView dequeueReusableCellW

作者: 不务正业的小肖 | 来源:发表于2018-05-30 13:35 被阅读0次

UITableView的重用从官方的API可以看到,UITableView的重用有两个方法如下:

1、- (nullable __kindof UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier

2、- (__kindof UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath

前者可以返回空值

后者不能返回空值

注意:如果是用NIB自定义了一个Cell,那么就调用第一个方法,如果是用代码自定义了一个Cell,那么就调用第二个方法。而且注册的Identifier与使用的需要保持一致,否则重用无效果,内存白白浪费

相关文章

网友评论

      本文标题:UITableView dequeueReusableCellW

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