change font of back button on uinavigationcontroller

前端 未结 5 1172
滥情空心
滥情空心 2020-12-25 12:14

I\'m trying to change the font color of the text on my back button in my UINavigationControllerBar

    [[UIBarButtonItem appearance] setTitleColor:[UIColor r         


        
5条回答
  •  不知归路
    2020-12-25 12:39

    Solution in Swift 4:

    UIBarButtonItem.appearance().setTitleTextAttributes(
    [
        NSAttributedStringKey.font: UIFont(name: "MyriadPro-SemiboldCond", size: 16)!,
        NSAttributedStringKey.foregroundColor: UIColor.white
    ], for: .normal)
    

    Add this in AppDelegate and it'll be applied to all buttons in the app.

提交回复
热议问题