Change the font of a UIBarButtonItem

前端 未结 16 1139
春和景丽
春和景丽 2020-12-07 09:18

\"UIToolbar

I have a UIBarButtonItem in my UIToolbar titled

16条回答
  •  不知归路
    2020-12-07 10:05

    In Swift 4, you can change the font and colour of UIBarButtonItem by adding the following code.

    addTodoBarButton.setTitleTextAttributes(
            [
            NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Bold", size: 17)!,
            NSAttributedStringKey.foregroundColor: UIColor.black
            ], for: .normal)
    

提交回复
热议问题