I implemented my own solution. The two solutions are actually, since I need different ones for the cases when I allowed and rejected PKRevealController actions.
Case 1 : setRecognizesPanningOnFrontView:NO
This case is pretty simple - I just add a UISwipeGestureRecognizer which calls my back method:
UISwipeGestureRecognizer *backSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(back)]; [backSwipe setDirection:UISwipeGestureRecognizerDirectionRight]; [self.view addGestureRecognizer:backSwipe];
Case 2 : setRecognizesPanningOnFrontView:YES
This is a little trickier. To avoid a gesture recognition conflict, I had to click on the PKRevealController gesture PKRevealController . Of course, I only implemented this when the PKRevealController does not have a leftViewController .
So, I register the class that I want to implement navigation from the back, as a listener for notifications:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(back:) name:NOTIFICATION_BACK_SWIPE object:self];
And then in the PKRevealController.m file, in - (void)moveFrontViewRightwardsIfPossible , just post a notification:
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_BACK_SWIPE object:[(UINavigationController *)self.frontViewController topViewController]];
Here I pass as the notification object the receiver of the UIViewController . I do this so that only this particular instance of the UIViewController responds to this notification. Otherwise, if you had more UIViewControllers in the UINavigationController stack that are subscribed to receive this notification, all of them will lead to the UINavigationController to the popViewController , which will lead to a random number of steps backward, as long as we want this to happen only once.
What is it. Enjoy it.