iOS 8 : UIButton appearance font

标签 ios ios8 uibutton uiappearance

尝试在 iOS 8 中使用外观为所有按钮设置 UIButton 的字体。谷歌搜索后,Apple 似乎已经改变了您在不同操作系统之间执行此操作的方式。在 iOS 7 中,这应该有效:

    UIButton.appearance().titleLabel?.font = UIFont.inviteButtonTitleFont()

但它似乎不再起作用了。有人知道你现在是怎么做的吗?

最佳答案

Swift 3:

let fontRegular = UIFont(name: "MyCustomRegularFont", size: 17.0)
UILabel.appearance(whenContainedInInstancesOf: [UIButton.self]).font = fontRegular
UIButton.appearance().tintColor = UIColor.red

关于iOS 8 : UIButton appearance font,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29477616/

相关文章:

ios - TableView 标签上显示的 TableView 数据

ios - 带有包装标签的静态表格单元格的动态高度?

ios - 在谷歌驱动器中上传 ipa

ios - Swift:在自动格式化 UITextField 后动画化 UIButton

iphone - UIButton 图像不会在 "for"循环中更改

ios - 带有 UIControlEventTouchDown 的 UIButton,在手指抬起之前图像不会更改为选中状态

iOS 和 Mopub : app freezes when loading ad on a slow network

ios7 - 自动布局 CGAffineTransform iOS7 iOS8

ios - 在 UIImageView 上打字

ios - UIActionSheet 与 UIAlertController - iPad