I'm using ECSlidingViewController (See Documentation) to achieve the sliding menu function.
What I intend to do
Here's the list of my ViewControllers
- SlidingMenu
- View Controller A (embedded in
Navigation Controller
) - View Controller B1
- View Controller B2
- View Controller C
The navigation sequence should like this:
A----------B1
| |-------C
|
|------B2
Also inside SlidingMenu
, there are options to go to ViewController
B1 or ViewController
B2 directly.
The effect I want to achieve is: when using SlidingMenu
to navigate to ViewController B1
or ViewController B2
, the Back
button on the navigation bar should take the view back to their parent view. (i.e, B1/B2 should back to A).
Problem
When the app is running, only after using the ECSlidingViewController
to navigate to B1/B2, the navigation bar on B1/B2 is missing and there's no "Back" button to get to their parent view (i.e. view A).
Please note: If B1/B2 is navigated via view A, then the navigation bar is fine and well displayed.
So, how can I achieve the desired effect? Is there any method to push the correct navigation stack in it rather than just replace the topViewController
?
Related Code
Inside the SlidingMenu view, there are two buttons for navigating to B1 and B2
- (IBAction)B1Pressed:(id)sender {
self.slidingViewController.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"B1"];
[self.slidingViewController resetTopViewAnimated:YES];
}
- (IBAction)B2Pressed:(id)sender {
self.slidingViewController.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"B2"];
[self.slidingViewController resetTopViewAnimated:YES];
}
Hope I can use these screenshots to elaborate the problem clearly:
Sliding Menu:
View A (top left button is to open the Sliding Menu)
View B1 (if navigate from View A, the navigation bar and "back" button are well displayed)
View B1 (if navigate from Sliding Menu, the navigation bar and "back" button are disappeared)