I have an application that presents its own password entry when the user either launches the application or reopens it from the background. When the user opens it from the background, there should not be a “flash” of the real application, in other words, the security screen must be fully loaded before the user opens the application again.
I have this setting great for most screens.
In one scenario, a user can rotate an application that calls segue from a tab bar controller into a horizontal view controller. In this case, I have a problem. If I did not pull out the rotating screen, the input screen will appear horizontally, even if the user reopens the application in the portrait.
If I fire him with animation, then the lock screen will not start loading until the application restarts, so you get flash content.
If I turn it off without animation, the lock screen will still be displayed horizontally.
Here is what is called from applicationDidEnterBackground:
TabBarController *tbc = (TabBarController*)self.window.rootViewController;
void (^openPasscode)() = ^void() {
KVPasscodeViewController *passcodeController = [[KVPasscodeViewController alloc] init];
passcodeController.delegate = self;
UINavigationController *passcodeNavigationController = [[UINavigationController alloc] initWithRootViewController:passcodeController];
[self.window.rootViewController presentViewController:passcodeNavigationController animated:NO completion:nil];
};
if (tbc.isShowingLandscapeView) {
[self.window.rootViewController dismissViewControllerAnimated:NO completion:openPasscode];
} else {
openPasscode();
}
source
share