Setting alpha on UIView sets the alpha on its subviews which should not happen

前端 未结 10 2367
借酒劲吻你
借酒劲吻你 2020-12-13 01:29

According to the documentation for UIVIew @property(nonatomic) CGFloat alpha

The value of this property is a floating-point number in the

10条回答
  •  半阙折子戏
    2020-12-13 02:02

    I think this is a bug in the documentation. You should file it at bugreport.apple.com.

    Everything I can see after a bit of quick research suggests what you are seeing is how it always has behaved, and my own testing shows it too.

    The alpha of a view is applied to all subviews.

    Perhaps all you need is [[UIColor blackColor] colorWithAlphaComponent:0.5] but if not you will need to make the view a sibling instead of a child.

提交回复
热议问题