I am working on a navigation based application which involves LOGIN view.
My approach to deal with the same navigation hierarchy (which was taking back to the login page)was
-
Use two navigation controllers
-
as soon as the user logs in create a new navigation controller
-
assign the new view controller’s root to the post login view
someViewController.navigationController = [[[UINavigationController alloc]initWithRootViewController:someViewController ] autorelease]; -
assign this navigation controller to the window:
MYAppDelegate *appDelegate = (MYAppDelegate *)[[UIApplication sharedApplication] delegate];appDelegate.navigationController = someViewController.navigationController;
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; [window addSubview:someViewController.navigationController.view]; [window makeKeyAndVisible];
-
-finally push the “someViewController” to stack.
[self.navigationController pushViewController:someViewController animated:YES];
ALL WORKING FINE TILL NOW..
outcomes:
-
the someViewController’s navigation controller is the new navigationController for the complete app and there is no way to go back to LOGIN view.
-
I am able to push new ViewControllers to the stack and navigate to and fro upto next level.
PROBLEM :!!
“I am only able to push new ViewControllers to the stack and navigate to and fro. up to the next level and not further…”
say:
(newroot)master–>subordinates–X->details. // i am not able to navigate to 3rd level.
(newRoot)subordinate–>details.
what else I have tried before posting?
- tried simply setting the root of the same navigationController to the POST-LOGIN ViewControlller
issue: it din’t worked either.
please guide
Thank you in anticipation.
Try the following way, take a navigationController in appDelegate say
navControllerIn loginViewController, after you login success,
then you can remove login screen as
[self.view removeFromSuperview];if added as subView