I think I'm missing something simple here. I need to create a semi-transparent UIImageView that covers the entire screen including the navigation toolbar. How do I do this?
This is what I'm trying to do ...
This is a possible solution:
UIImage *image=[UIImage imageNamed:@"whatever.png"];
UIImageView *overlay=[[UIImageView alloc] initWithImage:image];
overlay.alpha=0.5;
[[[[UIApplication sharedApplication] delegate] window] addSubview:overlay];
EDIT:
[overlay release]
.To focus the above answer a little bit, you just need to be clear on how views clip to what parts of the device's screen that they "own".
The key point is that in a navigation view, the Navigation bar itself is not part of your [myController view]
- your view controller's view is everything below the bar and anything you do in that view clips to the rectangle below that bar.
The bar is, however, part of your [myAppDelegate window]
. The window is essentially the entire screen of your device, while the views are sub portions responsible for managing their specific bounds. So calling [[myAppDelegate window] addSubView:]
will display above the bar where [[myViewController view] addSubView:]
will not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With