iphone - custom UIAlertView block effect

80 views Asked by At

I am making a custom alertView similar like standard alertView in iOS.

for making block effect , I did this

UIView * backgroundView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, screenWidth, screenHeight)];

backgroundView.backgroundColor = [UIColor blackColor];
backgroundView.alpha = 0.4f;
[view addSubview:backgroundView];

it works similar like showing standard alert.

but It doesn't works in Tabbar's Area.

How do I ?

[Before showing alert View] enter image description here [standard alertView Image] enter image description here

[cutom alertView Image] enter image description here

2

There are 2 answers

0
Keith Ellis On BEST ANSWER

Add backgroundView to UIWindow and bring backgroundView to front.

[[[[UIApplication sharedApplication] delegate] window] addSubview:backgroundView]
0
Reming Hsu On

Make sure that you add backgroundView on the top.

UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow];
[mainWindow addSubview: backgroundView];