Search code examples
xcodeinterface-buildersegueviewcontrollerpresentmodalviewcontroller

Xcode 11.1 View controller visible underneath current VC when presenting modally


Xcode automatically updated and now my signup screen view controller displays beneath the current view controller I transitioned to. See screenshot How can I fix this?

If I create a segue and select present modally using Interface Builder, when I run the App I'll now see the previous screen beneath the current one. This was never an issue until the update. (I am using the same background throughout the App so most of my View Controller backgrounds are set to transparent.)

Plus I think this is related, when I view my storyboard in Xcode with the view set to use iPhone 8 Plus it shows a light gray rounded rectangle that was not previously there. See storyboard layout When I run the App it appears that most of my view controllers are now constrained to this shape and no longer full screen. See this example here My settings view controller uses a white bg so you can more easily see what I'm talking about. This VC used to be full screen, not shifted down and rounded at the top. Any ideas?

Xcode 11.1 Targeting iOS 12.1


Solution

  • In iOS 13, if you have any storyboard segue, goto storyboard and you need to set the kind property to Present Modally and the Presentation property to Full Screen.

    For Programatically using Swift:

    let vc = UIViewController()
    vc.modalPresentationStyle = .fullScreen 
    self.present(vc, animated: true, completion: nil)
    

    For Objective-C:

    UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *vc = [story instantiateViewControllerWithIdentifier:@"identifier"];
    vc.modalPresentationStyle = UIModalPresentationFullScreen ;
    [self presentViewController:vc animated:YES completion:nil];