TableViewCell复用数据重复问题解决
作者:
macfai | 来源:发表于
2016-11-24 14:53 被阅读25次 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// 定义唯一标识
static NSString *CellIdentifier = @"Cell";
// 通过indexPath创建cell实例 每一个cell都是单独的
//只需要这里替换成自己自定义的cell就可以了
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
return cell;
}
本文标题:TableViewCell复用数据重复问题解决
本文链接:https://www.haomeiwen.com/subject/upbbpttx.html
网友评论