Reputation: 77
I am developing an application where i have to authenticate a user (in a view with two text fields for username and password and a button (login)) and then i have to navigate to tab bar controller. Could you please tell me how can i achieve this.
Upvotes: 0
Views: 176
Reputation: 46
You need to push the viewController on which you want to show tabbarController like this
[self.navigationController pushViewController:self.tabBarController animated:YES];
here self.tabBarController
is your required tabBarController which you want to shown on nextView controller.
You need to push with the tabBarController not with UIViewController
.
Upvotes: 1
Reputation: 104092
I think the best way to handle these login screen situations, is to have the tab bar controller as the root view controller of the window, and in the first tab's controller, present your login controller modally from the viewDidLoad method. In your login controller, if the login is successful, just dismiss the login controller, and you'll be back to your first tab's view. If it's not successful, just present some information to the user that the login failed, and leave the login screen up (or allow retries, whatever you want).
Upvotes: 1
Reputation: 2678
build your login view controller and tab-bar view controllers
now make your firs view is the login view controller ; once the login successfully done you can make [loginviewController presentModelViewController:tab-barControoler]
or you can add an navigation controller to your login view controller and once the login successful you can push the tabbar controller and set the navigation bar hidden
Upvotes: 1
Reputation: 11865
Create a view with your login stuff, then after a successful login, transition to a view with your tab bar controller.
Upvotes: 0