Cocoa/iPhone: BackgroundColor and Opaque Properties

前端 未结 1 502
鱼传尺愫
鱼传尺愫 2021-01-05 12:21

In Cocoa, specifically the iPhone SDK, the opaque property is described as:

If opaque, the drawing operation assumes that the view fill

1条回答
  •  清酒与你
    2021-01-05 13:28

    Try it and see is the only way forward on the iPhone, because like you say, despite the volume of the documentation that ships with the SDK, it's not very specific in many cases.

    As for opaque though, this is just a hint to the compositing engine that tells it it doesn't need to bother to displaying any layers that are covered by the opaque layer. However, the compositing is done by the graphics chip on the phone, so in many cases it is not more efficient to not draw the obscured part of a partially obscured layer, which is most likely why you are not seeing things get messed up at the moment (i.e. cocoa is ignoring the setting in the cases you've tried). By the same token you are not seeing a performance improvement from setting opaque to true.

    So my advice would be to stick with using the opaque property the way the docs say because you are risking a buggy rendering for no real benefit.

    0 讨论(0)
提交回复
热议问题