Reputation: 650
I use applicationWillResignActive
to display the splash image when my app is in background (see code-snippet). Reason: I don't want private data of the app be visible when my app is in background on iOS 7 and the user presses the Home button twice.
splashWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
splashWindow.windowLevel = UIWindowLevelAlert;
[splashWindow addSubview:splashViewController.view];
[splashWindow makeKeyAndVisible];
The problem is that applicationWillResignActive
is also fired when iOS shows an alert because some certificate is about to expire. How can I fix this? Do I need to take another approach to display the splash image in background?
Thanks for any advice
Upvotes: 2
Views: 1539
Reputation: 650
Fixed: I could not change the iOS behaviour as described but I used:
[self.window addSubview:splashViewController.view];
instead of the code-snippet above. The iOS alert still makes the splash appear but I hide it again in applicationDidBecomeActive
with [splashViewController.view removeFromSuperview];
The splash now disappears when the alert is answered with OK or Cancel.
Upvotes: 0
Reputation: 211
You could also use the applicationWillEnterBackground to open a blank screen/your splash image and switch back to your normal screen with applicationWillEnterForeground.
Upvotes: 2