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

Popping back to initial state #86

Closed
rafaelkaufmann opened this issue Jul 19, 2013 · 5 comments
Closed

Popping back to initial state #86

rafaelkaufmann opened this issue Jul 19, 2013 · 5 comments
Labels

Comments

@rafaelkaufmann
Copy link

I have an application using left and right menus, and I've been trying to find a "nice" way to make it automatically navigate from an "inner" VC of a right menu navVC, back to the application's initial content, that is, the first content of the left menu. I found no way to do it other than hacking SASlideMenuRootViewController.m and adding a notification listener:

-(void) viewDidLoad{
   ...
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(returnToRoot) name:@"returnToRoot" object:nil];
}

-(void) didReceiveMemoryWarning{
    [super didReceiveMemoryWarning];
    [controllers removeAllObjects];
}

-(void)returnToRoot {
    NSLog(@"Return to root");
    [self tapItem:nil];
    [self performSegueWithIdentifier:@"leftMenu" sender:self];
}

In the above code, [self tapItem:nil]; "pops" from the right menu, but without [self performSegueWithIdentifier:@"leftMenu" sender:self];, the previous right menu VC is displayed inside the left menu!

So, is there a way to achieve this navigation by just issuing UINavigationController-style pop commands?

@stefanoa
Copy link
Owner

stefanoa commented Aug 3, 2013

Sorry for the very late replay. I am not sure I understood correctly, if you need to pop out the right view controller there is a method of the SASlideRootViewController that pops away the right view controller:

-(void) popRightNavigationController;

I hope this helps.

@rafaelkaufmann
Copy link
Author

Hi Stefano, sorry myself for the late reply. Ah, there it is. Don't know how I could possibly have missed it. 👍

Thanks!

@rafaelkaufmann
Copy link
Author

So, popRightNavigationController does work, but it suffers from the same issue I initially noted: after calling it, the previous right menu VC is displayed inside the left menu! Also, on some cases, it does not slide out the right menu either.

@stefanoa
Copy link
Owner

Ok. I will have a look at it as soon as possible

stefanoa added a commit that referenced this issue Aug 21, 2013
@stefanoa
Copy link
Owner

Now you should call the UINavigationController method:

    [self.navigationController popViewControllerAnimated:YES];

However it will only pop away the topmost view controller, if you need to pop away all the stack of viewcontroller you should call:

       [self.navigationController popToRootViewControllerAnimated:YES];

The dynamic example now uses it. I hope this helps

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

No branches or pull requests

2 participants