使UIView和子视图半透明为一个层,而不是单独的 [英] Make UIView and subviews translucent as one layer, not individually

查看:139
本文介绍了使UIView和子视图半透明为一个层,而不是单独的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当设置UIView的alpha(在iOS上)时,它会将每个子视图设置为相同的值,但会在各自的超视图之上将它们与该alpha组合在一起。所以子视图与他们的超级视图混合在一起。

When setting the alpha of a UIView (on iOS) it sets each subview to the same value, but composites them with that alpha on top of their respective superviews. So the subviews are blended with their superviews.

我不希望这种情况发生。我希望将不透明度作为一个整体应用于UIView,而不是应用于每个单独的视图。我希望获得与CSS3不透明度相同的效果,或者将不透明度应用于Photoshop中的一组图层,而不是单独应用于每个图层。

I don't want this to happen. I want the opacity to be applied to the UIView as a whole, not to each individual view. I want to achieve the same effect as, say, CSS3's opacity, or applying opacity to a group of layers in Photoshop, rather than to each layer individually.

复杂度然而是这个UIView是一个UITableView和其他需要互动的。相反,将视图置于此视图之后是不可行的。

The complexity however is that in this UIView is a UITableView and others that need to be interactive. And it's not viable to have the view that is supposed to be behind this view on top instead.

我的问题是:实现此目的的最佳方法是什么?

My question is: What's the best way to achieve this?

谢谢!

Alec

Thank you!
Alec

推荐答案

Info.plist中有一个'具有组不透明度的渲染'设置

There's a 'Renders with group opacity' setting in Info.plist

此处的文档:
http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html

(搜索上述设置)。

这篇关于使UIView和子视图半透明为一个层,而不是单独的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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