突出显示时 barButtonItem 的字体会发生变化 swift 4.2
Font of barButtonItem changes when highlighted swift 4.2
我这里有一个 barbuttonItem:
let doneBarButtonItem: UIBarButtonItem? = {
let barButtonItem = UIBarButtonItem()
barButtonItem.setTitleTextAttributes([
NSAttributedString.Key.font : UIFont(name: "Avenir-Heavy", size: 12)!,
NSAttributedString.Key.foregroundColor : UIColor.black,
], for: .normal)
barButtonItem.title = "DONE"
return barButtonItem
}()
然而当我按下它时,它变成了不同的字体。突出显示时更改字体的 属性 是什么?谢谢你。
barButtonItem.setTitleTextAttributes([
NSAttributedString.Key.font : UIFont(name: "Avenir-Heavy", size: 12)!,
NSAttributedString.Key.foregroundColor : UIColor.black,
], for: .highlighted) // This line
我这里有一个 barbuttonItem:
let doneBarButtonItem: UIBarButtonItem? = {
let barButtonItem = UIBarButtonItem()
barButtonItem.setTitleTextAttributes([
NSAttributedString.Key.font : UIFont(name: "Avenir-Heavy", size: 12)!,
NSAttributedString.Key.foregroundColor : UIColor.black,
], for: .normal)
barButtonItem.title = "DONE"
return barButtonItem
}()
然而当我按下它时,它变成了不同的字体。突出显示时更改字体的 属性 是什么?谢谢你。
barButtonItem.setTitleTextAttributes([
NSAttributedString.Key.font : UIFont(name: "Avenir-Heavy", size: 12)!,
NSAttributedString.Key.foregroundColor : UIColor.black,
], for: .highlighted) // This line