tags:

views:

51

answers:

1

i'm creating a login for my application which is in table view.On success i want to load the table view and on failure load another view.. should i use two appdelegates or one would be sufficient? how do i switch controls..? thanks in advance..

A: 

Your application has only one delegate.

For what you are trying to do, you need three UIViewControllers: one responsible for the login, another one with your tableView, and the third one that will load when your login fails. Each of these viewControllers will have to be made either in code, either with the help of the Interface Builder.

Now, for you to have all these switch as you want, you may use a UINavigationController. You initialize it with your login viewcontroller by using

[navController initWithRootViewController: loginViewController];

I assume you already created and initialized your navigation controller and your login controller, of course.

When your login succeeds, you push your tableViewController onto the navigation stack:

[navController pushViewController: tableViewController animated: YES];

If your login fails, you would push your other view controller:

[navController pushViewController: badLoginController animated: YES];

If you don't want the navigation bar to show as you push your view controllers, you can set it to hidden by calling setNavigationBarHidden:animated: like this:

[navController setNavigationBarHidden: YES animated: NO];
luvieere
thanks a lot.. it was of great help...
dpaksp