I'm creating a custom UIAlertView
(from a UIView
). I'm trying to get the same background effect (when the background view darkens). So I created a new black UIView
with .5
opacity, and added it to the background.
The problem is, I have a tab bar. When the black UIView
covers the background, it doesn't cover the UIView
. Here are 2 images demonstrating my problem:
Standard UIAlertView
background:
Custom UIAlertView
background
Here is my code creating the background view
:
UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.frame];
[backgroundView setBackgroundColor:[UIColor blackColor]];
[backgroundView setAlpha:0.5f];
[self.view addSubview:backgroundView];
How can I get the UIView
to cover the tab bar?
Try adding backgroundView into self.view.window, not self.view.