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

前端 未结 10 2357
借酒劲吻你
借酒劲吻你 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:47

    For now there is only one way make the Parent View transparent and don't put any child views inside (don't put any views as subview) the parent view, put that child views outside of the parent view. To make parent view transparent you can do this via storyboard.

    //Transparent the parentView
    
    parentView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.8)
    

    Put the other view outside of the parent view. It will work like a charm.

提交回复
热议问题