0
我不明白它爲什麼如此。這裏是我的代碼:當它的bg顏色設置爲黑色時,UINavigationBar是白色
UINavigationBar.appearance().backgroundColor = UIColor.blackColor()
UINavigationBar.appearance().translucent = false
我不明白它爲什麼如此。這裏是我的代碼:當它的bg顏色設置爲黑色時,UINavigationBar是白色
UINavigationBar.appearance().backgroundColor = UIColor.blackColor()
UINavigationBar.appearance().translucent = false
變化backgroundColor
到barTintColor
和
試試這個
UINavigationBar.appearance().barTintColor = UIColor.blackColor()
UINavigationBar.appearance().translucent = false
e.g
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
UINavigationBar.appearance().barTintColor = UIColor.blackColor()
UINavigationBar.appearance().translucent = false
return true
}
或使用
self.navigationController!.navigationBar.barTintColor = UIColor.blackColor()
self.navigationController!.navigationBar.translucent = false
e.g
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController!.navigationBar.barTintColor = UIColor.blackColor()
self.navigationController!.navigationBar.translucent = false
}