Xcode常见问题
Optimization Opportunities: The layer is using dynamic shadows which are expensive to render. If possible try setting shadowPath, or pre-rendering the shadow into an image and putting it under the layer.
这是因为没有设置shadowPath导致了离屏渲染
解决方法有两种:
- 通过明确地设置shadowPath来“引导”阴影渲染,例如
1 | view.layer.shadowPath = UIBezierPath(rect: view.bounds).cgPath |
- 缓存
rasterization
(珊格化)
1 | view.layer.shouldRasterize = true |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Jerome Xiong!
评论