我怎么能不使用原型单元标识符重用单元格BUT

use*_*350 6 prototype cell reusability uitableview ios

我知道不能通过不调用此方法来重用单元格:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SomeID"]
Run Code Online (Sandbox Code Playgroud)

基于此处提供的说明.

但是,如果我使用Prototype单元怎么办?

因为如果我没有指定原型单元格的标识符,我的tableview只显示空白单元格.

And*_*rey -1

从缓存中提取单元格后,您应该立即重置您在方法中处理的所有内容。

然后继续设置特定指数的卖出。例如:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SomeID"];
if(cell)
{
    cell.textLable.text = nil;
    cell.accessoryItem = nil;
    ...
}

if(haveSomeText){
    cell.textLable.text = [allMyTexts objectForIndex:index];
}
if(needSetButton){
    cell.accessoryItem = [[UIButton alloc] init ...]];
}
...
Run Code Online (Sandbox Code Playgroud)