This probably has something to do with not properly setting up view controller containment. I bet -viewDidLoad
is not being called on your navigation controller's view controllers when you add the navigation controller's view as a subview to UIWindow
's rootViewController
. There's a good bit of literature out there on how to properly set up a custom view controller containment such that the right methods fire on your view controllers:
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html
Also, if Apple used the transition API for this interaction its possible that this has something to do with either the navigation controller's delegate not being hooked up properly (as it would when navigation controllers are set as root view controllers' on UIWindow), or the parent view controller stealing/hiding the gesture. I would first take a look at the navigation controller's pop gesture delegate and see if it not nil
:
NSLog(@"%@", self.navigationController.interactivePopGestureRecognizer.delegate);
If it's not nil
then I would check that a gesture recognizer on the navigation controller can fire normally:
// In the navigation controller's root view controller, try this:
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move)];
[panRecognizer setMaximumNumberOfTouches:1];
[self.view addGestureRecognizer:panRecognizer];
// Then test to see if its working:
- (void)move {
NSLog(@"Hello world.");
}