无法使用alpha:1.0添加新的uiview

时间:2013-09-23 07:24:36

标签: uiview io alpha

我想将UIView添加为self.view的子视图,使用alpha:1.0。

我正在分配     self.view.alpha = 0.5 在添加子视图之前。

当我将此子视图添加到self.view时,它也会获得alpha:0.5,这是我不想要的。 我想用alpha:1.0添加子视图。

所以请帮帮我....

1 个答案:

答案 0 :(得分:0)

//---------------------
//Parent view

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

//Subview

 [sview setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:1.0]];

//--------------------

  UIView *view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:.6];

它与:

不一样
 UIView *view.backgroundColor=[UIColor blackColor];    
 view.alpha=.6;