如何正确设置UIView的alpha? [iOS的] [英] How to correctly set alpha of UIView? [iOS]

查看:293
本文介绍了如何正确设置UIView的alpha? [iOS的]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 UIView ,包含大量子视图(UILabel,UITextView等)。

I have UIView with lots of subviews (UILabel, UITextView, etc.).

如果有一组alpha 0.6到主视图所有子视图都采用这个alpha。

If a set alpha 0.6 to main view all the subviews takes this alpha.

如何分别设置主视图的alpha?

How to set alpha separately of main view?

推荐答案

 [view setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:0.5]];

 //try this.. dont try to set alpha of UIView and also your subviews will not affect

这篇关于如何正确设置UIView的alpha? [iOS的]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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