码迷,mamicode.com
首页 > 其他好文 > 详细

100% opacity UILabel over a 50% opacity background (UIView?) UIView是百分之50透明而上面的UILable是100%不透明

时间:2014-10-29 12:50:50      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   sp   div   on   log   bs   

So right now I have a UIView with a UILabel in it. I want the background to have an opacity < 1.0 and the label to have an opacity of 1.0. However since alphas propagate down the view hierarchy, the label ends up with an opacity < 1.0 as well.

Is there anyway to do what I want without making the UILabel a subview of another view??

 

Just set the background color to be semitransparent:

view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5f];

 

100% opacity UILabel over a 50% opacity background (UIView?) UIView是百分之50透明而上面的UILable是100%不透明

标签:style   blog   color   ar   sp   div   on   log   bs   

原文地址:http://www.cnblogs.com/ghgyj/p/4059028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!