iOS离屏渲染

2017-05-24  本文已影响0人  百思不得Ting姐

来自 https://robots.thoughtbot.com/designing-for-ios-graphics-performance

以下情形,iOS会自动进行离屏渲染:

Core Graphics (any class prefixed with CG*)

The drawRect() method, even with an empty implementation.

CALayers with a shouldRasterize property set to YES.

CALayers using masks (setMasksToBounds) and dynamic shadows (setShadow*).

Any text displayed on screen, including Core Text.

Group opacity (UIViewGroupOpacity).

我们可以通过两种方法发现自己app哪些界面发生了离屏渲染:

1、通过Xcode自带工具Instruments(Xcode->Open Developer Tool->Instruments),打开Core Animation模板,如下图片:

点击底部工具栏Debug Options,从弹出菜单中选择Color Offscreen-Rendered Yellow

2、比较简单,用模拟器调试的时候,打开菜单Debug > Color Offscreen-Rendered选项。

上一篇下一篇

猜你喜欢

热点阅读