UIView clipsToBounds property: Does it improve performance?

前端 未结 3 851
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-13 01:47

The documentation says that the clipsToBounds property of UIView will clip the drawing to the bounds, or more precisely that the subView c

3条回答
  •  感动是毒
    2021-02-13 02:18

    The (possible) performance hit is only deterministic if you know the view hierarchy. As mentioned above, usually the renderer will use GPU cycles to draw the view UNLESS some view within the hierarchy uses drawRect:. This does not affect OpenGL ES application because drawRect:is omitted in this type of apps.

    From my understanding, determining and displaying the clipped area may take less cycles than actually calculating/drawing/blending the whole view. As of OpenGL ES 2.0 clipping can be calculated in GPU.

提交回复
热议问题