How do you create a semi-transparent background for a UIView?

前端 未结 8 1034
耶瑟儿~
耶瑟儿~ 2021-02-13 10:19

I am creating a UIView containing some text that partially covers a UIImageView. I want the user to be able to read the text and still maintain a perspective on the image undern

8条回答
  •  无人共我
    2021-02-13 10:55

    For Xamarin C#, at this time, the visual storyboard does not have the "opacity" slider of Xcode's storyboard mentioned by Bocaxica.

    If you set BackgroundColor for View nameOfView in storyboard, then in your view controller's ViewDidLoad, add this line to set alpha:

    nameOfView.BackgroundColor = nameOfView.BackgroundColor.ColorWithAlpha( 0.7f );  // A value between 0 and 1.
    

提交回复
热议问题