TruniTr
TruniTr

Reputation: 366

Why does the tab bar item not show up?

I am developing an App that has the following set up:

There is a login screen; if the login is successful, then the tab bar view is opened. All views are created in main.storyboard. The opening is handled as follows:

instantiateViewControllerWithIdentifier("personalViewController") as! PersonalViewController
self.presentViewController(vc, animated: true, completion: nil)

It does open my new view controller, but the bar items are not visible. Anyone knows how to fix this?

Thanks!

Upvotes: 0

Views: 3040

Answers (3)

leafcutter
leafcutter

Reputation: 777

presentViewController is going to open the personalViewController as a modal view. If you want to push the view onto the navigation controller stack (i.e. open it like a new screen) then you could/should use:

self.navigationController?.pushViewController(viewController: UIViewController, animated: Bool)

Upvotes: 0

Sanne
Sanne

Reputation: 427

You have to open the TabBarViewController instead of the viewcontroller that is inside of the tabbar viewcontroller.

Upvotes: 3

Rahul Mayani
Rahul Mayani

Reputation: 3831

I recommend just looking at the documentation in XCode. All documentation is written in Swift and Objective C so it is very easy to translate between the two languages. Also read apple's swift basics to understand this code translation better: https://developer.apple.com/library/mac/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-XID_467

Upvotes: 0

Related Questions