I am trying to create a custom container controller within my iPhone app. I would like this container to implement custom transitions, just like the default behavior of TabBarControllers and NavigationControllers within iOS 7. I have successfully been able to add custom animations to my transitions, but am having trouble adding the interactive logic.
As part of the transition process, I must create a TransitionContext. This is normally created by the system, but since I am using a custom container controller I have created my own class that conforms to the UIViewControllerContextTransitioningProtocol. When the gesture recognizer tied to the transition is triggered, I attempt to begin the transition by calling:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PrivateTransitionContext _animator]: unrecognized selector sent to instance 0x14654a80
UIPercentDriveInteractiveTranstion uses private APIs.
Alek Åström writes about this on his iOS Nomad blog where he walks through creating an interactive custom container controller (emphasis added):
... we can see that UIPercentDrivenInteractiveTransition looks for the animator in our context, calling an undocumented method. Conveniently enough, all Apple-made transition contexts implement this method and that's how the percent driven transition can fire the animation. Unfortunately, that means we cannot use the class for our own custom container view controllers.
He recommends using
AWPercentDrivenInteractiveTransition as a drop in replacement.