Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad presentViewController is always Fullscreen (need formSheet) iOS6

I need to present a viewController as a formSheet when the user taps a 'settings' button in the navigation bar in the iPad side of my universal app. The view is called "SettingsViewController," and it's a View Controller in my iPad Storyboard with an ID of "settings".

I'm not using segues because in my iPad version of the app, I have more than one button in the navigation bar on the left side, so I have to add the buttons progammatically. (can't connect a segue to a nonexistent UIBarButtonItem in the storyboard.)

The functionality I want is there, the presentation is not. When I present my SettingsViewController, on the iPad, it's presenting as a full screen view. I need it to be a form sheet.

I'm wrapping it in a NavigationController, which I need and works fine, just need it to present itself in the correct manner.

Here's the code that presents the view:

-(void)showSettings:(id)sender {

    SettingsViewController *svc = [self.storyboard instantiateViewControllerWithIdentifier:@"settings"];
    svc.delegate = self;
    svc.modalPresentationStyle = UIModalPresentationFormSheet;
    UINavigationController *navcont = [[UINavigationController alloc] initWithRootViewController:svc];
    [self presentViewController:navcont animated:YES completion:NULL];

}

I've tried everything I can think of. Any help is deeply appreciated.

like image 668
jhilgert00 Avatar asked Dec 14 '12 02:12

jhilgert00


People also ask

How do I make my view controller full screen?

Present ViewController in full screen To prevent this, the presentation style can be changed. To present the DetailViewController full screen, the modalPresentationStyle property of a view controller must be set to . fullScreen before it will be presented.

How do I make IOS view full screen?

To view programmes in full screen, simply use the 'pinch and zoom' screen gesture. This will allow you to adjust the view between an aspect fit and an aspect fill.

How do you make swift full screen?

Press Ctrl + Drag your UIView to Safe Area, choose Equal Height and do the same for the Width. Save this answer.


1 Answers

Looks like you set the modal presentation style on SettingsViewController but you should have set it on your UINavigationController.

like image 103
geraldWilliam Avatar answered Sep 17 '22 15:09

geraldWilliam