I am new in xcode. I use xcode 7.
I am trying to add a navigation bar on tab bar controller.
in that screenshot, i selected top translucent bar black but it doesn't appear when i run the project
My main purpose is to show a top bar and add an image (logo) on it.
How can i achieve this ?
To add a tab, first drag a new View Controller object to the storybard. Next control-drag from the tab bar controller to new view controller and select view controllers under Relationship Segue . Your tab bar controller will update with a new tab.
The Tab Bar It is usually present on most pages within an app and has the same disadvantages as the navigation bar. One important difference between tab bars and navigation bars is that tab bars are persistent, that is, they are always visible on the screen, whether the user scrolls down the page or not.
A tab bar controller keeps a reference to its child view controllers. We can access that array through the viewControllers property of the tab bar controller. That's part of the solution. In the viewDidLoad() method of the TabBarController class, we invoke a helper method, setupChildViewControllers() .
To add the new View Controller to the Tab Bar Controller, right-click the Tab Bar Controller and drag it to the new View Controller. Select Relationship Segue. Now, the Tab Bar Controller has the third item and Relationship “view controllers” to “View Controller”.
Your format is not correct. please add Navigation Controller in your tab controller.
Select your ViewController
and Click Editor > Embed In > Navigation Controller
like this :
Add navigation controller like this :
I hope its work for you.
Add image to your navigation bar :
var image = UIImage(named: "abc.jpg") as UIImage
self.navigationController.navigationBar.setBackgroundImage(image,
forBarMetrics: .Default)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With