更改子视图的alpha而不更改父视图的alpha

Ank*_*han 0 iphone ipad

我有两个uiviews 1个孩子和1个父父视图在点击按钮时有alpha .30我想将子视图的alpha更改为1.0或0.0这是可能的,如果是,那么如何.

请赐教我这个.

提前Thanx :)

Jha*_*iya 13

尝试使用和的alpha属性.UIView此值仅影响当前视图,不会影响其任何嵌入的子视图.

阅读苹果文档的alphaUIView.

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html

更新:尝试以下

[parentView setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:0.5]];
[childView setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:1.0]];
Run Code Online (Sandbox Code Playgroud)