0

In my app after pressing the login button in my loginViewController, it push to front viewController of my SWRevealViewController. In my RearViewController I have the sign out button. When I press it it should pop to the back viewController again (LoginViewController). But even though I set the button click event like this it doesnt navigate to the loginViewController.

-(void)signOutClick :(id)sender
    {
      [self performSelectorInBackground:@selector(moveToLoginView) withObject:nil];
    }

-(void)moveToLoginView
    {
      [self.navigationController popToRootViewControllerAnimated:YES];
    }

But when I swipe the view it gose to the back view.I want to disable that swipe feature to the back view. And I want to go to the back view when click on the sign out button in my RearViewController. How can I do that? Please help me.

Thanks

IRD
  • 1,127
  • 2
  • 8
  • 15

2 Answers2

-1

I am not sure but instead of using

[self.navigationController popToRootViewControllerAnimated:YES];

try using,

[self.navigationController popViewControllerAnimated:YES];

And to stop swipe gesture you can use code like,

-  (void)viewWillAppear:(BOOL)animated 
{
   [super viewWillAppear:animated];
   self.revealViewController.panGestureRecognizer.enabled = NO;
}
Paddy
  • 766
  • 5
  • 16
  • You need to check the stack of navigation controller. If you get the controller you want, just pass that controller for pop. – Paddy Jul 29 '15 at 11:13
-2

You need to reset the top view controller if you want to perform these kind of actions off of a click. E.g.

get an instance of the ECSlidingViewController

ECSlidingViewController *slidingController = self.slidingViewController;

get the view controller you wish to be on the top

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"mainViewController"];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];

set the topViewController property

slidingController.topViewController = nc;
[slidingController resetTopViewAnimated:NO];
JordanMazurke
  • 1,103
  • 10
  • 22