首页 > 代码库 > 100% opacity UILabel over a 50% opacity background (UIView?) UIView是百分之50透明而上面的UILable是100%不透明
100% opacity UILabel over a 50% opacity background (UIView?) UIView是百分之50透明而上面的UILable是100%不透明
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%不透明
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。