iPhone:使视图透明但子视图不透明 [英] iphone: make view transparent but subviews non transparent

查看:56
本文介绍了iPhone:使视图透明但子视图不透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为A的自定义UIViewController,我想将其视图添加为另一个控制器(名为B)视图作为子视图.A的视图包含两个按钮作为子视图.我想使A的视图透明,但其中的按钮不透明.我想知道有什么办法吗?

I have a Custom UIViewController named A and i want to add its view to another controllers (named B) view as subview. A's view contain two buttons as subviews. I want to make A's view transparent but the buttons in it nontransparent. I want to know is there any way to do it?

推荐答案

我注意到,

如果视图设置了不透明度/alpha值,则所有子视图都将应用该不透明度/alpha值.

If a view is set a opacity/alpha value, all its subviews will be applied with that opacity/alpha value.

尝试将视图背景色设置为 [UIColor clearColor]

Try setting the views background color to [UIColor clearColor]

这篇关于iPhone:使视图透明但子视图不透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆