UITableViewCell性能优化

5.UITableViewCell性能优化

1> 定义一个循环利用标识

static NSString *ID = @"C1";

2> 从缓存池中取出可循环利用的cell

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];

3> 如果缓存池中没有可循环利用的cell

if (cell == nil) 
{
  cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
}

4> 覆盖cell上面的数据

cell.textLabel.text = [NSString stringWithFormat:@"第%d行数据", indexPath.row];
原文地址:https://www.cnblogs.com/huluo666/p/3622111.html