我将为rightBarButtonItem使用自定义字体,但是我想获取当前用于设置该字体大小为自定义字体大小的字体。
let myButton = UIBarButtonItem(title: "Button",
style: .plain,
target: self,
action:#selector(MyVC.buttonTapped(_:)))
navigationItem.rightBarButtonItem = myButton
let size = myButton...???
myButton.setTitleTextAttributes([NSAttributedStringKey.font: UIFont(name: "SomeCustomFont", size: size)! ], for: .normal)
有什么主意吗?或其他方法?
答案 0 :(得分:0)
您可以获取Lazy<Task<T>>
的大小,如下所示:
UIBarButtonItem