3

I have an app with a user interface that contains two items, each of which is its own view controller. When you decide to change one of the items, I use presentViewController:animated:completion: with UIModalPresentationCurrentContext to modally present a picker over just the item you're changing. Since the view controller is set to define a presentation context, this ensures not only that the picker covers only that view controller, but also that its presentingViewController is the one for that item, so the unwind segue triggered by picking an item passes through that view controller too, changing the item.

This works beautifully, except that I want to do it with a custom (and hopefully interactive) transition. To accomplish that, I tried to set the picker's transitioningDelegate to a custom object implementing UIViewControllerTransitioningDelegate. However, the transitioningDelegate is ignored unless you use UIModalPresentationCustom, which ignores definesPresentationContext and presents from the root view controller, thus breaking this whole arrangement.

Is there some way to present a modal view controller with a custom transition that respects presentation contexts? Or am I going to have to find another way to do this?

Becca Royal-Gordon
  • 17,541
  • 7
  • 56
  • 91

0 Answers0