Question

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....

Was it helpful?

Solution

//---------------------
//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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top