美文网首页
iOS Instruments 中 Core Animation

iOS Instruments 中 Core Animation

作者: ErHu丶 | 来源:发表于2017-03-13 17:33 被阅读47次

1.Color Blended Layers 像素混合

红色代表存在像素混合问题

解决方法:

设置opaque为YES (默认就为YES);

设置backgroundColor;

设置layer.masksToBounds = YES;(只设置这个参数不会导致离屏渲染,iOS8之后显示中文若不设置则会出现像素混合问题;)

2.Offscreen Rendering(离屏渲染)

黄色代表该图层需要离屏渲染,导致原因有:cornerRadius, masks, shadows,edge antialiasing 等

解决方法:

1.尽量不使用圆角,若使用则设置:

layer.shouldRasterize = YES;

layer.rasterizationScale = [UIScreen mainScreen].scale;

2.阴影绘制shadow:使用ShadowPath来替代shadowOffset等属性的设置

imageViewLayer.shadowPath = CGPathCreateWithRect(imageRect, NULL);

这些可以优化性能.

3.Color misaligned images (像素对齐)

紫色代表像素不对齐,黄色代表需要缩放.

解决方法:

坐标的设置 X,Y 最好都是整型.

http://www.jianshu.com/p/db6602413fa3 (引荐这位大神 对 Color Blended Layers 的总结) 

http://www.jianshu.com/p/2a01e5e2141f (引荐这位大神 对性能优化的总结)

http://www.jianshu.com/p/5c968a240e27 (引荐这位大神 对视图优化的浅谈)

相关文章

网友评论

      本文标题:iOS Instruments 中 Core Animation

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