问题
Making UI of my app using code only. Can't find how customize couple elements: 1. Button 'Back' now it looks like:
and it should looks like:
So, how I can get rid of 'Back' text from button title, keeping '<' system icon there? And how I can change colors of back button and title of navigation bar?
回答1:
try
self.navigationController?.navigationBar.tintColor = UIColor.white
回答2:
Try:
override func viewDidLoad(){
//any other initial stuffs
//for the bar
navigationController?.navigationBar.tintColor = UIColor.black
//for the button
navigationController?.navigationBar.backItem?.titleView?.tintColor = UIColor.white
}
回答3:
Follow the instruction from your xcode. You can do this easily. I also marked on the image . Select 1. Select the Standard Editor, 2. Show the File inspector 3 Set global Ting
来源:https://stackoverflow.com/questions/40958996/change-color-and-back-button-title-of-navigation-bar-from-swift-3-code