1
在我的應用程序中,我已將導航欄後退按鈕顏色設置爲紅色。在所有屏幕中,箭頭和文字均可與iPhone完美兼容。但在iPad中,它僅適用於主屏幕。當我進入任何其他視圖控制器時,我的導航返回文本呈紅色,但後退按鈕箭頭變成灰色。這裏是我的代碼,導航欄後退按鈕顏色在iPad中不工作
func setup() {
self.navigationBar.barTintColor = UIColor.blue()
UINavigationBar.appearance().titleTextAttributes = [
NSForegroundColorAttributeName : UIColor.white,
NSFontAttributeName : UIFont(name: "Arial", size: CGFloat(22.0))!
]
self.navigationBar.isTranslucent = true
UINavigationBar.appearance().tintColor = UIColor.red
// self.navigationBar.tintColor = UIColor(red: CGFloat(132.0/255.0), green: CGFloat(204.0/255.0), blue: CGFloat(90.0/255.0), alpha: CGFloat(1.0))
// Draw a bottom border
let bottomBorderHeight = 3/UIScreen.main.scale
let bottomBorder = UIView(frame: CGRect(x: CGFloat(0), y: CGFloat(self.navigationBar.frame.size.height-bottomBorderHeight), width: CGFloat(self.view.bounds.width), height: CGFloat(bottomBorderHeight)))
bottomBorder.backgroundColor = UIColor(red: CGFloat(0/255.0), green: CGFloat(97/255.0), blue: CGFloat(56/255.0), alpha: CGFloat(1.0))
self.navigationBar.addSubview(bottomBorder)
}
嘗試barTintcolor,外觀,酒吧風格等..但沒有什麼作品。任何想法? TIA。
是否'tintAdjustmentMode'幫助? – Puttin
什麼時候你會調用這個方法func setup()? – KKRocks
嘗試更換/與你添加這些線UINavigationBar.appearance()。isTranslucent =真 UINavigationBar.appearance()。tintColor = UIColor.red UINavigationBar.appearance()。barTintColor = UIColor.blue – KKRocks