【问题标题】:What size font is the title in a default UIButton?默认 UIButton 中的标题是什么大小的字体?
【发布时间】:2013-06-23 21:24:43
【问题描述】:

UIButton 中的默认字体大小是多少?

我查看了 Apple 的文档,但找不到 - https://developer.apple.com/documentation/uikit/uibutton

【问题讨论】:

  • 感谢您的回答,我很少使用界面生成器,所以这可以解释为什么我找不到它。

标签: ios uibutton font-size


【解决方案1】:

它的System Bold 15.0。你可以在这里查看。

您可以使用此代码更改字体。

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

【讨论】:

    【解决方案2】:

    你可以在创建按钮的时候在Interface Builder中看到,是:

    系统粗体 15.0

    【讨论】:

      【解决方案3】:

      只需查看 Xcode 中的 Storyboard 编辑器,选择 Round Rect Button,您就可以在 Attributes Inspector 中看到字体为“System Bold”尺寸 15 (pt)。

      【讨论】:

        【解决方案4】:

        creatingUIButton 使用代码以编程方式创建大小为 18 点和字体 SFUI-Regular 的按钮。因此,当您通过 Interface Builder(大小为 15 的 System Bold)或以编程方式创建它时,它会有所不同。

        【讨论】:

          猜你喜欢
          • 2019-05-16
          • 2012-05-09
          • 2021-09-23
          • 2011-09-03
          • 2011-11-09
          • 2021-04-30
          • 2013-04-09
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多