Can you override a parent UIView's alpha value on one of its subviews?

落花浮王杯 提交于 2019-12-05 08:02:24

You are correct. You'll have to move the UILabel out of the transparent view to get it to render as non-transparent.

Brian is right. For example :

view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];

will make a Black background in alpha 0.6 and other views won't be affected.

Another approach which worked easily is to not modify the alpha channel on the UIView. Instead, modify the alpha layer on the backgroundColor object of the UIView.

Of course this depends on why you made the alpha layer transparent, but it worked well for my requirements.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!