RyJ*_*RyJ 2 uibutton ios uiappearance ios8
尝试使用iOS 8中的外观为所有按钮设置UIButton的字体。谷歌搜索之后,苹果似乎已将您的操作方式从操作系统更改为操作系统。在iOS 7中,这应该可以工作:
UIButton.appearance().titleLabel?.font = UIFont.inviteButtonTitleFont()
Run Code Online (Sandbox Code Playgroud)
但这似乎不再起作用。有人知道你现在怎么做吗?
斯威夫特3:
let fontRegular = UIFont(name: "MyCustomRegularFont", size: 17.0)
UILabel.appearance(whenContainedInInstancesOf: [UIButton.self]).font = fontRegular
UIButton.appearance().tintColor = UIColor.red
Run Code Online (Sandbox Code Playgroud)