Im using SWRevealViewController to create a sliding menu.
When the user presses the bar button of initial view controller, a new second view controller has to open. The user has to navigate back again to the initial view controller when the barbutton is pressed from the second view controller.
Im using the following code to move the used from second view controller to initial view controller.
SWRevealViewController *revealViewController = self.revealViewController;
if ( revealViewController )
{
[self.sidebarButton setTarget: self.revealViewController];
[self.sidebarButton setAction: @selector( goBack )];
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}
But im getting the following error message,
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SWRevealViewController goBack]: unrecognized selector sent to instance
Following is my goBack method
- (IBAction)back:(id)sender {
[self.navigationController popToRootViewControllerAnimated:YES];
}