質問

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.

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top