Geoff Hackworth
1 min readMar 17, 2020

--

I’m not sure what value it has, but you can use a UIAdaptivePresentationControllerDelegate to disable the default adaption from a form/page sheet to full screen in a compact width environment. It’s not quite the same (the presenting view controller doesn’t change size), but it looks similar and, importantly, does not remove the presenting view controller from the view hierarchy. Of course, it doesn’t support swipe to dismiss or the iOS 13-only delegate methods.

In my Adaptivity app there is a setting called “Adapt Modal Presentations”. That is enabled by default, but when it is disabled I use the delegate to prevent the adaption to full screen.

{
// If we do NOT want to adapt modal presentations, use a delegate to prevent adaptation
if ([ADTAppSettingsManager sharedInstance].adaptModalPresentations.value == NO) { navigationController.presentationController.delegate = self; } [self presentViewController:navigationController animated:YES completion:nil];}
#pragma mark - UIAdaptivePresentationControllerDelegate
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(nonnull UITraitCollection *)traitCollection{
// This *prevents* adaption to full screen in compact width environments
return UIModalPresentationNone;}
iOS 12 Form Sheet presentation. Left is default adaption; right uses adaptivePresentationStyleForPresentationController:traitCollection: to prevent adaption

--

--

Geoff Hackworth
Geoff Hackworth

Written by Geoff Hackworth

Independent and freelance software developer for iPhone, iPad and Mac

No responses yet