Is UIView's opaque property with a value of YES in conflict with its backgroundColor property with a value of [UIColor clearColor]?

前端 未结 2 1863
北荒
北荒 2021-01-04 12:09

such as the code:

view.opaque = YES;

and

view.backgroundColor = [UIColor clearColor];

any one who can exp

相关标签:
2条回答
  • 2021-01-04 12:49

    No, it shouldn't be. It should act clear. The color clear is completely opaque, if that even makes sense. It won't show up black or white or anything else if you change its alpha. It will be clear.

    0 讨论(0)
  • 2021-01-04 13:03

    The opaque flag is used as an optimization for rendering. If you set it to YES when the view shouldn't be opaque you can get unexpected rendering if you actually want things to be visible through the view.

    My understanding is that the opaque flag is sometimes checked to see if alpha value should even be checked.

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