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).
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.