I'm having the hardest time implementing a presentation of a drawer sliding partway up on the screen on iPhone.
EDIT: I've discovered that iOS is not respecting the .custom modalTransitionStyle I've set in the Segue. If I set that explicitly in prepareForSegue:
, then it calls my delegate to get the UIPresentationController
.
I have a custom Segue that is also a UIViewControllerTransitioningDelegate. In the perform()
method, I set the destination transitioningDelegate to self:
self.destination.transitioningDelegate = self
and I either call super.perform()
(if it’s a Present Modal or Present as Popover Segue), or self.source.present(self.destination, animated: true)
(if it’s a Custom Segue, because calling super.perform()
throws an exception).
The perform()
and animationController(…)
methods get called, but never presentationController(forPresented…)
.
Initially I tried making the Segue in the Storyboard "Present Modally" with my custom Segue class specified, but that kept removing the presenting view controller. I tried "Present as Popover," and I swear it worked once, in that it didn't remove the presenting view controller, but then on subsequent attempts it still did.
So I made it "Custom," and perform()
is still being called with a _UIFullscreenPresentationController
pre-set on the destination view controller, and my presentationController(forPresented…)
method is never called.
Other solutions dealing with this issue always hinge on some mis-written signature for the method. This is mine, verbatim:
public func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController?
I've spent the last four days trying to figure out “proper” custom transitions, and it doesn't help that things don’t seem to behave as advertised. What am I missing?