I use a custom back button in tons of places in an app I'm working on, so I have a category on UINavigationController that adds a pushViewControllerWithBackArrow method that sets a custom back arrow on the view controller being pushed, then pushes it. However, I can't seem to get the interactivePopGestureRecognizer working. The code I've found here on stack overflow and online all either subclass UINavigationController or set the interactivePopGestureRecognizer in the pushed view controller.
One solution (http://keighl.com/post/ios7-interactive-pop-gesture-custom-back-button/) involved adding this code to viewDidLoad in the UINavigationController subclass:
__weak UINavigationController *weakSelf = self;
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)weakSelf;
}
which was semi-functional, but if I swiped back when in my root view controller it locked up the UI. The solution to this problem involved subclassing UINavigationController and overriding pushViewController and didShowViewController, which I would like to avoid.
Is there any way to make the gesture recognizer work on a UINavigationController category?