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.
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.
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.
Press Ctrl + Drag your UIView to Safe Area, choose Equal Height and do the same for the Width. Save this answer.
Looks like you set the modal presentation style on SettingsViewController
but you should have set it on your UINavigationController
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With