我可以调整导航栏外观的所有其他方面 - 但“返回”的字体仍然很顽固。
下面的 MWE 显示了我尝试过但无济于事的四件事
1)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedString.Key.font: UIFont(name: "Helvetica-Bold", size: 4)!], for: .normal)
return true
}
2) 3) 4)
类 customNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
UIBarButtonItem.appearance().setTitleTextAttributes(
[
NSAttributedString.Key.font : UIFont(name: "Rockwell", size: 4)!,
NSAttributedString.Key.foregroundColor : UIColor.white,
], for: .normal )
navigationItem.backBarButtonItem?.setTitleTextAttributes([NSAttributedString.Key.font: UIFont(name: "Chalkduster", size: 7)!], for: .normal)
navigationBar.topItem?.backBarButtonItem?.setTitleTextAttributes([NSAttributedString.Key.font: UIFont(name: "AvenirNextCondensed-DemiBoldItalic", size: 4)!], for: .normal)
}
}