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

前端 未结 8 1059
耶瑟儿~
耶瑟儿~ 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 11:09

    I think what you mean is you want the backgroundColor of your UIView to be semi transparent? If you want white/transparent use this:

    myView.backgroundColor = [UIColor colorWithWhite:myWhiteFloat alpha:myAlphaFloat];
    

    else if you want it to be another color use the general UIColor method: +colorWithRed:green:blue:alpha:

提交回复
热议问题