Venu Gandhe
Venu Gandhe

Reputation: 77

IOS5 : how to navigate from view to tab bar controller

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

Answers (4)

Fazal Yazdan
Fazal Yazdan

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

rdelmar
rdelmar

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

Omar Freewan
Omar Freewan

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

Bot
Bot

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

Related Questions