Hi together,
I need to use a popoverPresentation controller in my universal app. This works great for the iPad. But on the iPhone it's always presented modal in full screen. How to force a popoverPresentationController on the iPhone?
Walter
Hi together,
I need to use a popoverPresentation controller in my universal app. This works great for the iPad. But on the iPhone it's always presented modal in full screen. How to force a popoverPresentationController on the iPhone?
Walter
Hi Walter
This should be possible by supplying a delegate for the popover presentation controller that implements - adaptivePresentationStyleForPresentationController:. Your implementation should return UIModalPresentationNone.
...that worked. Thanks!
Have a nice weekend
Hi Justin!
I had some issues trying to display UIPopoverPresentationController on iPhone not in full screen, as you suggested to use adaptivePresentationStyleForPresentationController: , it really helped, but the problem is that you have to implement
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion NS_AVAILABLE_IOS(5_0);
only after you you get the popover presentation controller and configure it. While in documentation it's said that you have to implement it before the configuration.
// Present the view controller using the popover style.
myPopoverViewController.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:myPopoverViewController animated: YES completion: nil];
// Get the popover presentation controller and configure it.
UIPopoverPresentationController *presentationController =
[myPopoverViewController popoverPresentationController];
presentationController.permittedArrowDirections =
UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight;
presentationController.sourceView = myView;
presentationController.sourceRect = sourceRect;
If we present the popover before the UIPopoverPresentationController setup it'll be presented modal in full screen, I had spent a long time before I could understand what was the problem, don't you think you should mention it in documentation? Thanks!
David