UIPresentationController simulating UIModalPresentationOverCurrentContext

Is there a way to simulate UIModalPresentationOverCurrentContext style using a UIPresentationController?


I want to use a presentation controller in my presentation, so then I'll have to set UIModalPresentationCustom as the presentation style of the presented controller.

But I want the presentation to be only over the current context.


Returning NO in -[UIPresentationController shouldPresentInFullscreen], doesn't seem to do anything.

Replies

Hi riadhluke


Presentations using a custom UIPresentationController can not initiate a presentation in the current context.

So the docs for shouldPresentInFullscreen in UIPresentationController says "You can override this method and return

false
to force the presentation to display only in the current context."


What does that method do then if a custom UIPresentationController can not initiate a presentation in the current context?

I found this property works when presenting further modals.


e.g. a Modal ontop of a Modal


Setting it to `true` will make the `presentingController` the window's root view controller vs `false` the presening source. Similarly the `containerView` of the transition will be a subview of the window when the property is set to `true` vs a subview of the current context when set to `false`.


It's such a shame we can't replicate `overCurrentContext` presentations with custom presentation controllers. Does anyone have any suggestions on how to over come this ?

Hi Justin,


Is this still the case in iOS 10?

I've found that with custom presentation controllers, the presenting VC is always the root VC.

I want to create a custom presentation where if the presenting controller is a specific VC (that I wrote), I want to animate some internal contents of that VC along with the presentation transition.


Using custom presentation controllers is much less involved than using View Controller Containment, but it seems that it's impossible for this case?


Thanks.