John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 987 forks source link

Is there a way to use PushViewController from Menu #644

Open vkoppaka opened 8 years ago

vkoppaka commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

A sample written in Swift:

SWNavTest.zip

Hope this helps.

GaneshKumarSelvam commented 7 years ago

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

iDevelopper commented 7 years ago

By pushing the tab bar controller itself!

GaneshKumarSelvam commented 7 years ago

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 commented 7 years ago

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

GaneshKumarSelvam commented 7 years ago

SWTabBar.zip

Please have a look @iDevelopper

iDevelopper commented 7 years ago

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 commented 7 years ago

Superb Thanks @iDevelopper 👍

IamAbdulQadar commented 6 years ago

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 commented 6 years ago

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

https://github.com/iDevelopper/PBRevealViewController

chejarla-venkatesh commented 6 years ago

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

iDevelopper commented 6 years ago

@chejarla-venkatesh What? SWTabBar sample or https://github.com/iDevelopper/PBRevealViewController?

chejarla-venkatesh commented 6 years ago

@iDevelopper SWNavTest..🙂

iDevelopper commented 6 years ago

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

chejarla-venkatesh commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@iDevelopper I have just seen project demo on github. It really does looks better than SW. But as I said I can't make changes to my original project right now.. But I will install it for a demo application.

On Thu, Sep 20, 2018 at 4:31 PM Patrick notifications@github.com wrote:

@chejarla-venkatesh https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/John-Lluch/SWRevealViewController/issues/644#issuecomment-423141591, or mute the thread https://github.com/notifications/unsubscribe-auth/AYBslPmbQU_bnWcriDtf9_m3sp3PTFPHks5uc3WHgaJpZM4Ku__Q .