Question

I've encountered this bad internal state of UIView Controller:
Sometimes, the presented vc removed from screen, but remains on its presentingVC, as the vc.presentedViewController.

In this state you cannot present any other vc before you dismiss the previous invisible presented vc.

Était-ce utile?

La solution

The problem occurs when calling [UIWindow makeKeyAndVisible],
while there's a presented vc.

You can dismiss and present the modal immediately (no UI glitches):

    [window makeKeyAndVisible];

    if (myCurrentVC.presentedViewController != nil) {
            UIViewController *presented = myCurrentVC.presentedViewController;
            [myCurrentVC dismissViewControllerAnimated:NO completion:nil];
            [myCurrentVC presentModalViewController:presented animated:NO];
    }

Works great for me

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top