문제

I want to add UIView as a subview to self.view with alpha:1.0.

I am assigning self.view.alpha = 0.5 before adding subview.

When I add this subview to self.view it also gets alpha:0.5 which I don't want. i want to add the subview with alpha:1.0.

So please help me....

도움이 되었습니까?

해결책

//---------------------
//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];

It's not the same as:

 UIView *view.backgroundColor=[UIColor blackColor];    
 view.alpha=.6;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top