【问题标题】:How to increase Font Size in button Pragmatically (swift3)如何以编程方式增加按钮中的字体大小(swift 3)
【发布时间】:2017-10-14 19:43:10
【问题描述】:

我希望用户能够使文本变大。

我已经知道如何增加按钮的整体大小,但文本保持不变。

button.frame =  CGRect(x: 100, y: 400, width: 100, height: 50)

如何在swift3中实用地增加按钮的字体大小?

【问题讨论】:

标签: ios swift button text swift3


【解决方案1】:

使用titleLabel,像这样:

let button = UIButton()
button.titleLabel?.font = UIFont.systemFont(ofSize: 30)

你可以通过多种方式使用 UIFont,检查它的构造函数!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-12
    • 2022-12-03
    • 2011-01-05
    • 1970-01-01
    • 2015-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多