美文网首页
优化tableview

优化tableview

作者: 路这么长 | 来源:发表于2016-11-18 15:44 被阅读18次
  • 1 willDisPlayCell 处理数据 cell与数据完成绑定

 -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

    }
  • 2 设置cell的属性

//设置 cell进行异步加载
cell.layer. drawsAsynchronously = YES;
//设置 cell完全不透明 减少渲染时间
Cell.opaque = YES;
  • 3 若cell上有网络请求下来的图片,将图片的处理单独开一个线程

//异步处理图片 
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// 在线程中所做的处理 
                ...

            [Cell.imageViewActivity sd_setImageWithURL:[NSURL URLWithString:model.thumb] placeholderImage:[UIImage imageNamed:@"imageDefault"]];
 
        });

相关文章

网友评论

      本文标题:优化tableview

      本文链接:https://www.haomeiwen.com/subject/lkfspttx.html