Dar
Dar

Reputation: 185

Load TTNavigator when needed,Show another viewController without persisting it in Navigator

I am making an application in which user needs to login/sign up, if the application opens for the first time or there are no default login info available. This login/signup view is regular UIViewController View. Now, I have a MainMenu View which is TTLauncherView which would be shows to the user - if user successfully login/(signup and login) - if there are already saved info in userdefaults and the saved credentials are authenticated by the server So the login/signup page would be visible to user only when there are no userdefaults saved. I have implemented both (login.signup page separately and a functional launcherview which is the MainMenu view), but am not able to redirect user after successful login, as it initiates the TTNavigator and I don't want to persist the login page in the Navigator's page heirarchy. After alot of search I figures, that I can change the Key Window and implement both on separate windows and after a successful login make the other window key-window and resign the previous one. But I am not sure how to do it and is this the right way to do it.

Upvotes: 2

Views: 777

Answers (1)

Dar
Dar

Reputation: 185

I found the answer on Three20 google group, so wanted to share if anyone's interested There are 2 ways to do it,

  1. After login was successful, clear the memory of all the views ever persisted (in my case just 1) using.

    [navigator removeAllViewControllers];
  2. Present the login screen as ModalViewController and after successful login, dismiss the ModalViewController, which deallocs the view and is not persisited.

to present the Login as ModalViewController:

[[TTNavigator navigator] openURLAction:[[[TTURLAction actionWithURLPath:
@"tt://account"] applyTransition:UIViewAnimationTransitionFlipFromRight]
applyAnimated:YES] ]; 

to dismiss the view controller:

[self dismissModalViewControllerAnimated:YES];

Upvotes: 3

Related Questions