Reputation: 327
I'm trying to change the color of my TabBar from the default color to a different color? How do I do this programmatically with swift? Also, how do I assign an image as the background for a navigation bar? Sorry if this is an easy question, I'm new to programming.
Upvotes: 1
Views: 1181
Reputation: 596
let's say if you have a tab bar controller. you can do something like this in viewDidLoad()
self.tabBarController?.tabBar.backgroundColor = UIColor.redColor()
self.tabBarController?.tabBar.tintColor = UIColor.blueColor()
and for navigation controller image
var image = UIImage(named: "filename")
self.navigationController?.navigationBar.setBackgroundImage(image, forBarMetrics: UIBarMetrics.Default)
Upvotes: 2