Search code examples
iosblockeffectalertview

iphone - custom UIAlertView block effect


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


Solution

  • Add backgroundView to UIWindow and bring backgroundView to front.

    [[[[UIApplication sharedApplication] delegate] window] addSubview:backgroundView]