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

Disconnnect With Storyboard #84

Closed
thibault-carpentier opened this issue Jul 16, 2013 · 4 comments
Closed

Disconnnect With Storyboard #84

thibault-carpentier opened this issue Jul 16, 2013 · 4 comments

Comments

@thibault-carpentier
Copy link

Hi, first of all thanks for your amazing work on your menu.

I m using your menu with storyboard and i would like to implement a disconnect action.
I have to implement the segueIdForIndexPath method. How can i with this action properly disconnect a depop all the viewcontrollers ?

Thanks for your answer :-)

@stefanoa
Copy link
Owner

Sorry for the late replay, It seems that you managed to solve the issue by yourself. In any case if I understand correctly, you need a way to Activate and Deactivate the SASlideRootViewController.
I normally use SASlideMenu after a sign in, thus when the sign in is successful:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController* controller = [storyboard instantiateViewControllerWithIdentifier:@"Main"];
[self presentViewController:controller animated:YES completion:^{
    MyAppDelegate* app = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
    [app.window setRootViewController:controller];
}];

The "Main" view controller is a subclass of SASlideMenuRooViewController.
When I want to pop away the menu and sign out what I do is:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController* controller = [storyboard instantiateViewControllerWithIdentifier:@"SignIn"];
[self presentViewController:controller animated:YES completion:^{
   MyAppDelegate* app = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
   [app.window setRootViewController:controller];     
}];

The "SignIn" view controller is the view controller for the sign in with the userid/password fields.
I hope that this will help.

@thibault-carpentier
Copy link
Author

Yeah i ve managed to do the trick, but i had to trick it because the disconnect method is directly callable from the left menu, and i dont want to trigger a segue for this indexpath, is there a proper way ?

Thanks for your answer :-)

@stefanoa
Copy link
Owner

In the example that I posted I did not used a segue, using the presentViewController: method and than changing the root view controller of the app window should work.

@mradlmaier
Copy link

Stefano,

I don't understand, where this code should go (your code above, first snippet):

UIStoryboard storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController
controller = [storyboard instantiateViewControllerWithIdentifier:@"Main"];
[self presentViewController:controller animated:YES completion:^{
MyAppDelegate* app = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
[app.window setRootViewController:controller];
}];

And where should that code (your code above, the second snippet) go?

UIStoryboard storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController
controller = [storyboard instantiateViewControllerWithIdentifier:@"SignIn"];
[self presentViewController:controller animated:YES completion:^{
MyAppDelegate* app = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
[app.window setRootViewController:controller];
}];

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

3 participants