iosobjective-cviewcontrollerios13presentviewcontroller

Presenting the ViewController in full screen


I am presenting a view controller in a button action as follows,

PromptController *obj = [[[PromptController alloc]initWithNibName:@"PromptController" bundle:nil]autorelease];
UINavigationController *navigation = [[[UINavigationController alloc]initWithRootViewController:obj]autorelease];    
[self presentViewController:navigation animated:YES completion:nil];
[AVSession stopRunning];

But it is not presenting on the full screen of the phone. It is presenting as follows enter image description here

How to present it on the full screen. Any help is really appreciated


Solution

  • In iOS 13 the default presentation style has changed. If you want iOS 12 presentation style, you can change the modalPresentationStyle to .fullScreen.

    Swift Version

    navigation.modalPresentationStyle = .fullScreen
    

    Objective C

    navigation.modalPresentationStyle = UIModalPresentationOverFullScreen;