Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to use PushViewController from Menu #644

Open
vkoppaka opened this issue Nov 10, 2016 · 18 comments
Open

Is there a way to use PushViewController from Menu #644

vkoppaka opened this issue Nov 10, 2016 · 18 comments

Comments

@vkoppaka
Copy link

Hello,

We are using Right Menu and the menu / reveal all seems to work OK. But, in addition to the right menu we still show iOS native back button to go back to the previous view controller the user is on. We are now trying to push some view controllers from the menu and are unable to do so. Is there anyway to use PushViewController (or equivalent) where we keep the back button and still show the hamburger menu?

The issue we are facing is if we call NavigationController.PushViewController, NavigationController on Menu will be nil because Menu does not have a NavigationController. If we are going with RevealViewController().PushViewController or RevealViewController().PresentViewController we are losing the back button.

Any ideas to approach this will be of great help.

Thanks

@iDevelopper
Copy link

Yes, push your VC with a navigation controller, then push this navigation controller with SW:

UINavigationController *frontVC = (UINavigationController *)self.revealViewController.frontViewController;
[frontVC pushViewController: yourVC animated:NO];
[self.revealViewController pushFrontViewController:frontVC animated:YES];

@iDevelopper
Copy link

A sample written in Swift:

SWNavTest.zip

Hope this helps.

@GaneshKumarSelvam
Copy link

Hey, @iDevelopper how about for pushing view controller when it is with tab bar?

@iDevelopper
Copy link

By pushing the tab bar controller itself!

@GaneshKumarSelvam
Copy link

GaneshKumarSelvam commented Aug 30, 2017

please give me an example?

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewControllerSlide * vcs=[storyboard instantiateViewControllerWithIdentifier:@"ok"];
UITabBarController * tab=(UITabBarController *)self.revealViewController.frontViewController;
[tab.navigationController pushViewController:vcs animated:YES];
[self.revealViewController pushFrontViewController:tab.navigationController animated:YES];

I'm doing this but getting the blank screen!

Reply me ASAP?

screen shot 2017-08-30 at 4 18 21 pm
This is my Storyboard rear is slide menu and a front is tab bar, I need push view controller for slide menu!

@iDevelopper
Copy link

What did you try? Upload a project and I will have a look!

@GaneshKumarSelvam
Copy link

SWTabBar.zip

Please have a look @iDevelopper

@iDevelopper
Copy link

The front view controller is UITabBarController class, not UINavigationController. Then retrieve the controller for the selected tab and its navigation controller and push:

    UITabBarController *tbc = (UITabBarController *)self.revealViewController.frontViewController;
    UINavigationController *nc = tbc.selectedViewController;
    [nc pushViewController:myVC animated:NO];
    [self.revealViewController setFrontViewPosition:FrontViewPositionLeft animated:YES];

SWTabBar.zip

@GaneshKumarSelvam
Copy link

Superb Thanks @iDevelopper 👍

@IamAbdulQadar
Copy link

Thank you @iDevelopper really you win my heart . I was stuck with this issue and now with your swift code its working perfectly once again thank you so much :)

@iDevelopper
Copy link

For the future, as SWRevealViewControler seems not to be maintained, see:

https://github.com/iDevelopper/PBRevealViewController

@chejarla-venkatesh
Copy link

@iDevelopper This is the best solution I have ever found on internet. Thank you so much for your sample code and solution.

@iDevelopper
Copy link

@chejarla-venkatesh
Copy link

@iDevelopper SWNavTest..🙂

@iDevelopper
Copy link

@chejarla-venkatesh Why don't you try PBRevealViewController?

@chejarla-venkatesh
Copy link

@iDevelopper Now My project is almost done and I don't want to disturb it. But I will try it for a sample demo project and would definitely include in my next project for sure.

@iDevelopper
Copy link

@chejarla-venkatesh I do not say it's better but SW seems not to be maintained anymore. One more feature of PB vs SW is the possibility that the side view (left or right) can be shown over the main view.

@chejarla-venkatesh
Copy link

chejarla-venkatesh commented Sep 20, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants