[英]Navigation bar back button colour not working in iPad
在我的應用中,我將導航欄的后退按鈕顏色設置為紅色。 箭頭和文本在所有屏幕上均可與iPhone完美配合。 但是在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。
在Swift 3中,嘗試使用此行更改后退按鈕的顏色更改
self.navigationController?.navigationBar.tintColor = UIColor.red
希望對您有用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.