Closed SCLDev closed 8 years ago
look into popAllAndSwitchToViewController
Thank you very much! I will try it.
I came across another problem, the left menu on one of my views disappears for some reason when I popAllAndSwitch... Do you want me to open a different question? Not sure if it's best if I use this issue for it or not.
look into the demo project, it does exactly what you need, start with a login page, and after that go to the rest of the app
Thanks for your advice. I looked at the demo. I am sorry but I forgot to tell you that in my login view, I am hiding the navigation bar and I show it just before the transition code.
The left button works if I navigate to another view, and then back to the 'Main menu' view. However, when a user logs in, there aren't any left menu button.
Is there a refresh method for the left button, or can I do something like:
[self.navigationItem setLeftBarButtonItem: [SliderNavigationController sharedInstance]leftMenuButton] from the 'Main Menu' view?
there is no refresh button, as long as you implement the delegate methods properly it should work
I've implemented the delegate methods, like this:
//The 'Main Menu (VotingViewController) .h file'
@interface VotingViewController : UIViewController
I've got a rightBarButtonItem that takes me to another viewcontroller (SnapView), I've used this in the VotingViewController:
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
bundle: nil];
UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"SnapViewSegue"];
// [[SlideNavigationController sharedInstance] setViewControllers:[NSArray arrayWithObject:vc] animated:YES]; [[SlideNavigationController sharedInstance]popAllAndSwitchToViewController:vc withSlideOutAnimation:YES andCompletion:nil];
In SnapView, If user press a cancel button, they will be returned to the VotingView (Main Menu) like this:
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
bundle: nil];
UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"VotingView"];
// [[SlideNavigationController sharedInstance] setViewControllers:[NSArray arrayWithObject:vc] animated:YES]; [[SlideNavigationController sharedInstance]popAllAndSwitchToViewController:vc withSlideOutAnimation:YES andCompletion:nil];
And this is how I snap back to the loginview:
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
bundle: nil];
UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"LandinPageViewSegue"];
[[SlideNavigationController sharedInstance]popAllAndSwitchToViewController:vc withSlideOutAnimation:YES andCompletion:^{
[[FBSDKLoginManager new]logOut];
}];
Only my VotingView (main menu) is the slider delegate, and they all have the left button available through the method:
-(BOOL)slideNavigationControllerShouldDisplayLeftMenu{ return YES; }
I've looked over and over the demo, and I can't figure out where I'm going wrong. Is it because I've added a custom right barbutton? Or do I need to change everything manually? Do I need to assign every view controller as delegate?
I tried the popToRootAndSwitchToViewController method in other viewcontrollers as well, but they will have a backbutton as left barbutton item.
The commented out code is for when I tried to set the rootviewcontroller to see if that would help, but that didn't work, so I commented it out.
Hi, I am creating an app, in which I want to have a login menu to be displayed. After user logs in, I want to show the rest of the app, which is navigating using the slider menu.
I have got it to work fine, the only problem is that my previous login view is shown behind the left menu when left menu is displayed.
Do you know what I need to do to sort it out?
Thank you