tableView性能优化

在自定义cell时加上这几句代码

 

        // 1. 栅格化,美工的术语:将 cell 中的所有内容,生成一张独立的图像

        // 在屏幕滚动时,只显示图像

        self.layer.shouldRasterize = YES;

        // 栅格化,必须指定分辨率,否则默认使用 * 1,生成图像!

        self.layer.rasterizationScale = [UIScreen mainScreen].scale;

        

        // 2. 异步绘制!如果 cell 比较复杂,可以使用!

        self.layer.drawsAsynchronously = YES;

 

在使用YYWebImage时,cell显示gif图时,可以利用KVC

// 利用 KVC 修改 imageView 的类型

        [self setValue:[[YYAnimatedImageView alloc] init] forKey:@"imageView"];

posted on 2016-08-17 15:41  路很长  阅读(234)  评论(0编辑  收藏  举报