关于dequeueReusableCellWithIdentifier: [英] About dequeueReusableCellWithIdentifier:
本文介绍了关于dequeueReusableCellWithIdentifier:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
案例1:使用
initWithStyle:reuseIdentifier:
案例2:使用
[[NSBundle mainBundle] loadNibNamed:@"MyCell"
owner:self options:nil];
案例1将创建可重用的单元格与特定标识符组合在一起,并将其推送到可重用的队列中。
Case 1 will create reusable cell combined together with specific identifier,which will be pushed into the reusable queue.
案例2将从nib文件创建一个单元格,但不能像案例1那样放入可重用的队列。
Case 2 will create one cell from nib file, but can not be put into the reusable queue as case 1.
问题是
案例2的任何解决方案使单元格可以重复使用?
推荐答案
在XIB中,有一个UITableViewCell设置其重用标识符的设置。如果你在那里设置它,你可以从dequeue方法正常检索它。
In the XIB there is a setting for the UITableViewCell to set its reuse identifier. If you set it there, you can retrieve it as normal from the dequeue method.
这篇关于关于dequeueReusableCellWithIdentifier:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文