gpt4 book ai didi

ios - 以编程方式将字体更改为 System Semibold

转载 作者:IT老高 更新时间:2023-10-28 11:40:50 26 4
gpt4 key购买 nike

我正在尝试以编程方式设置字体。我想像在界面构建器中使用的那样使用 System Semibold。一直在字体列表中寻找它。我需要使用

[myButton.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Semibold" size:13.0]]

?

最佳答案

从 iOS 9 开始,iOS 的系统字体是“San Fransisco”。要获得半粗体版本,您可以使用以下内容:

swift 2.2:

UIFont.systemFontOfSize(20, weight: UIFontWeightSemibold)

swift 3.0:

UIFont.systemFont(ofSize: 20, weight: UIFontWeightSemibold)

swift 4.0:

UIFont.systemFont(ofSize: 20, weight: .semibold)

有关这方面的更多信息,请参阅 UIFont Class Reference .

关于ios - 以编程方式将字体更改为 System Semibold,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33261212/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com