Error when instantiating a UIFont in an text attributes dictionary

后端 未结 4 945
北恋
北恋 2020-12-11 01:58

I\'m trying to set the font of the UIBarButtonItem like so:

let barButton = UIBarButtonItem.appearance()
barButton.setTitleTextAttributes([NSFon         


        
4条回答
  •  [愿得一人]
    2020-12-11 02:21

    if let font : UIFont = UIFont(name: "Roboto-Regular", size: 15)
            {
                cancelBarButton.setTitleTextAttributes([NSFontAttributeName: font], forState: UIControlState.Normal)
                doneBarButton.setTitleTextAttributes([NSFontAttributeName: font], forState: UIControlState.Normal)
    
            }
    

提交回复
热议问题