首页 > 其他 > 详细

UITableViewCell性能优化

时间:2014-03-25 09:58:07      阅读:385      评论:0      收藏:0      [点我收藏+]

5.UITableViewCell性能优化

 

bubuko.com,布布扣
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];
bubuko.com,布布扣

UITableViewCell性能优化,布布扣,bubuko.com

UITableViewCell性能优化

原文:http://www.cnblogs.com/huluo666/p/3622111.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!