Reputation: 3
Can anyone please point me in the right direction? I want to make navigation
at the top of a tableView
like in attached image. Also how do I add the title
at the top?
Below is the image:
Upvotes: 0
Views: 100
Reputation: 4858
In viewDidLoad
:
self.navigationController?.title = "History"
self.navigationController?.navigationBar.barTintColor = UIColor(red: 74.0/255.0, green: 124.0/255.0, blue: 199.0/255.0, alpha: 1.0)
self.navigationController?.navigationBar.isTranslucent = false
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.white]
self.navigationController?.navigationBar.tintColor = UIColor.white
In relation to your further question below. Yes you can still do this if you are coming from a TabBar Controller:
Upvotes: 1
Reputation: 47
Select your View Controller in Storyboard
In the Top Menu go to Editor-->Embed In-->Navigation Controller
Then Automatically Navigation Bar Appers on the top of Your View Controller
To Add Title Select Navigation Bar in View Controller then in Attributes Inspector you can give the Title
Upvotes: 0
Reputation: 143
In xcode choose Editor > Embed In > Navigation Controller, then you can see the title on the top of your tableview, then search "nav item" and drag it to top of tableview navigation, and put the title text from setting. I hope this will help you.
Upvotes: 0