سؤال

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