kayue
kayue

Reputation: 2566

Tab bar in a View instead of Window

Is it possible to use tab bar in a view instead of window? Seems everyone add tab bar to their window.

My first screen is a login screen, which doesn't need tab bar. After user login, it change to the second screen, which contain a tabbar.

Thank you for your time :)

Upvotes: 0

Views: 207

Answers (3)

Robert Conn
Robert Conn

Reputation: 877

Yes it's possible. You can use interface builder to add a UITabBar to whatever view you want. The view controller for the view should then implement the protocol UITabBarControllerDelegate to handle selections of tab bar items.

It's worth having a look at the template tab bar project that you can create in XCode to understand this. The view containing the tab bar is owned by the view controller - it's this view that gets added to the window in the application delegate -

- (void)applicationDidFinishLaunching:(UIApplication *)application {

    // Add the tab bar controller's current view as a subview of the window
    [window addSubview:tabBarController.view];
}

Upvotes: 0

Jordan
Jordan

Reputation: 21760

I'd recommend you load your tabbar, then check for login credentials. If not found, showModal window to prompt for New Registration or Login Credentials.

Upvotes: 3

MHarrison
MHarrison

Reputation: 182

Everything in an iPhone app is displayed in a view, which is then displayed by a window.

Upvotes: 1

Related Questions