UILabel transparency

I am using UILabel to store some text. I want to make UILabel a background with an alpha of 0.4, but not text. How do you achieve this?

+3


source to share


2 answers


Select your shortcut in Interface Builder. In the Attribute Inspector, find Background under Appearance. Click on the color rectangle next to the color name. Opacity is one of the properties that you can set in the window that appears. Set this value to 40%.



+5


source


yourLabel.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.4];

      



Obviously, you can change the RGB colors to whatever you want.

+5


source







All Articles