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

前端 未结 10 2356
借酒劲吻你
借酒劲吻你 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 01:56

    Please refer to the bold description from Xcode documentation.

    The value of this property is a floating-point number in the range 0.0 to 1.0, where 0.0 represents totally transparent and 1.0 represents totally opaque. Changing the value of this property updates the alpha value of the current view only. However, the transparency imparted by that alpha value affects all of the view's contents, including its subviews. For example, a subview with an alpha value of 1.0 that is embedded in a parent view with an alpha value of 0.5, appears onscreen as if its alpha value is also 0.5.

提交回复
热议问题