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

前端 未结 8 1049
耶瑟儿~
耶瑟儿~ 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

    Eventually you already have a color so you could use .colorWithAlphaComponent like this:

    let exampleColor = UIColor.blackColor()
    overlayView.backgroundColor = exampleColor.colorWithAlphaComponent(0.8)
    

提交回复
热议问题