I have a sequence of views that are pushed on top of each other on a Navigation Controller. I would like to do two things with these views:
I posted this question on SWRevealViewControllers github site and received an answer from Patrick Bodet who was EXTREMELY helpful. I will post the answer below so it may help somebody in the same situation as I.
I had to update the storyboard and added an additional navigation controller as shown below.
As shown in the figure, I wanted to be able to push view controllers on top of each other and also to unwind the segues both to the Login screen (from the Menu) and from stacked view controllers.
On my previous attempts, it seemed as if SWRevealViewController wasn't able to cope with proper navigation segues. Patrick's first suggestion was to move the original navigation controller from before the RevealViewController to before the First view controller. That actually worked, by I still needed to be able to unwind segue from the Menu to the Login screen, so I needed an additional navigation controller.
As suggested by Patrick, I added an additional Navigation Controller. And embarrassingly at the end I realised the button that pointed from the third to the first view controller had both an ibaction and a segue to the first, so that was why it was acting all weird! :-(
So, for the storyboard shown above, in order to work you just use regular Push segues for the view controllers. No need to use SWRevealViewControllerSeguePushController segues.
The code for First and Third view controllers is like this:
#import "ThirdViewController.h"
#import "SWRevealViewController.h"
#import "FirstViewController.h"
@interface ThirdViewController ()
@property (weak, nonatomic) IBOutlet UIBarButtonItem *menuButton;
@end
@implementation ThirdViewController
- (void)viewDidLoad {
[super viewDidLoad];
SWRevealViewController *revealViewController = self.revealViewController;
if (revealViewController) {
[self.menuButton setTarget: revealViewController];
[self.menuButton setAction: @selector( revealToggle: )];
}
}
- (IBAction)returnToFirst:(id)sender {
[self performSegueWithIdentifier:@"First" sender:self];
//[self.navigationController popToRootViewControllerAnimated:YES];
}
@end