iOS开发

UITableView的调优技巧

2017-04-09  本文已影响23人  43b86d3b5040

常用写法:


MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCell"];
   if (cell==nil) {
       cell = [[MyCell alloc] initWithStyle:UITableViewCellStyleDefault
                                        reuseIdentifier:@"cell"];                     
   }
   return cell;
   

系统中的view.opaque默认是YES,绘图系统会将view看成为完全不透明,这样绘制系统就可以优化一些绘
制操作以提升性能。如果设置的为NO,那么绘制系统需要结合其他内容来处理view。

Apple官方文档堆opaque属性的解释如下:

This property provides a hint to
he drawing system as to how it should treat the view. If set to YES,
the drawing system treats the view as fully opaque, which allows the
rawing system to optimize some drawing operations and improve
performance. If set to NO, the drawing system composites the view
normally with other content. The default value of this property is YES.

上一篇下一篇

猜你喜欢

热点阅读