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.
答案 0 :(得分:2)
假设你有一个标签栏控制器。 你可以在viewDidLoad()
中做这样的事情self.tabBarController?.tabBar.backgroundColor = UIColor.redColor()
self.tabBarController?.tabBar.tintColor = UIColor.blueColor()
和导航控制器图像
var image = UIImage(named: "filename")
self.navigationController?.navigationBar.setBackgroundImage(image, forBarMetrics: UIBarMetrics.Default)