0

I am using ECSlidingViewController for creating "hamburger" menu for user with some options and one of them is login. I edited first example in archive with ECSlidingViewController and it's working and looking good.

Now I just want to extend this to have option after successful login to "redirect" user back to controller from which he taps on "hamburger" and go to login (like on websites). I think that I would need to save somewhere (maybe AppDelegate) from where I was going, is it right?

My AppDelegate looks like this:

@interface MAAppDelegate : UIResponder <UIApplicationDelegate> @property (nonatomic, strong) ECSlidingViewController *slidingViewController; @property (strong, nonatomic) UIWindow *window; @end 

This is method which is call after tap on "hamburger" (navigation bar item):

- (IBAction)menuButtonTap:(id)sender { if (self.slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionCentered) { [self.slidingViewController anchorTopViewToLeftAnimated:YES]; } else { [self.slidingViewController resetTopViewAnimated:YES]; } } 

And in my MAMenuViewController (controller with static table for options in side menu) I have sets a few sliding segues for table cells to go to each controllers (main, login and so).

2 Answers 2

0

Why not present the login view as a modal. The user isn't going 'back' from the login, they are cancelling, and it is, conceptually, completely separate functionality to the other part of the app. Presenting modally would usually use a different transition style and marks the screen out as something different.

While the modal is presented, you can also reset the sliding controller so your 'under' menu is no longer displayed. Then, when you dismiss the login view you are already ready without further animations.

Sign up to request clarification or add additional context in comments.

1 Comment

Oh, I totally forget to use modal. You're right. I can show login view controller with using modal and then easy dismiss it. Thanks
0

I think, if i'm right, that what you want to achieve here is " Pushing back " to your previous view controller. So, in that case, you might want to call, in your current view controller

[self.navigationController popViewControllerAnimated:YES]; 

You can get full answer with more information on this post. On this post, you may found a little more explanation on this post too, on how to identify previous view controller.

1 Comment

I was thinking about this before but this is working with using Navigation controller right? So this couldn't help me. I was trying to explain it. I was using another segues then push.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.