Set UIViewController background to transparent
Posted
by dbonneville
on Stack Overflow
See other posts from Stack Overflow
or by dbonneville
Published on 2010-03-28T23:20:28Z
Indexed on
2010/03/28
23:23 UTC
Read the original article
Hit count: 692
I'm calling a UIViewController from a button on the main view. I have set the alpha of the view to 50%. When the view animates in, I can see that it's transparent. As soon as the animation stops, it becomes opaque.
In the xib, when I set opacity, it's sets the opacity over white. So if I set the color to black and the opacity to 50%, this is what I see when I click the button on the main interface to show the view:
- view slides up from bottom at 50% opacity. I can see the underlaying view through the transparent black nicely.
- when view stops animating, it become gray. it appears that a white color pops in the background of the view somehow, making the 50% opacity black over white turn gray.
- I can no longer see the underlaying layer.
What I'm trying to do: show 100% white text on a 50% transparent black layer which sits over the view that called this view.
How on earth do I do this?
I tried a code method that sets the background color when the view is called, but it does exactly the same thing (with another try in there commented out with the same effect):
- (IBAction)gotoCreed {
Creed *creed = [[Creed alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:creed animated:YES];
self.view.backgroundColor = [UIColor colorWithHue:0.0 saturation:0.0 brightness:1.0 alpha:0.2];
//self.view.backgroundColor = [UIColor clearColor];
}
© Stack Overflow or respective owner