petersteinberger.com - Peter Steinberger

Description: UIPresentationController - Detecting if We Are Presented as Popover As we’re finally dropping iOS 7 in PSPDFKit, I’ve lead the project …

Example domain paragraphs

As we’re finally dropping iOS 7 in PSPDFKit , I’ve lead the project to migrate everything to Apple’s new wonderful UIPresentationController API. Now UIPresentationController is by far not perfect, but it’s a huge step forward coming from UIPopoverController and makes presenting in mixed environments much simpler and cleaner. The beauty: The view controller hierarchy is now correct, where in the older popover controller there were unconnected gaps, and it wasn’t easy to go from the contentViewController to t

Sometimes it’s quite useful to know inside the view controller if we are presented as a popover or modally. Of course things like a close button should be managed by the presenter, not the presented object, however there might be other changes (keyboard specifics, moving bar buttons around to have space for the close button, sizing differences). These cannot be determined by the trait classes alone. Initially I was naive and just checked for the existence of .popoverPresentationController - but since the sy

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 @implementation UIPresentationController (PSPDFAdditions) // This is more hacky than it should be! - ( UIModalPresentationStyle ) pspdf_currentPresentationStyle { // We can't use the trait collection from the presentation object, // since that one will always be compact if it's an UIPopoverPresentationController. UIViewController * vc = self . presentedViewController . presentingViewController ; if ( vc

Links to petersteinberger.com (1)