【问题标题】:How to change cell label font size?如何更改单元格标签字体大小?
【发布时间】:2017-12-25 19:33:00
【问题描述】:

我想更改表格单元格标签上的字体大小。字体应该保持不变。我正在使用

系统 - 系统

因为这是 Xcode 界面中显示的内容。

我正在做以下事情

tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

但是什么都没有发生。有什么建议应该怎么做?

cell.labelName.font = UIFont(name: "System - System", size: CGFloat(16))

【问题讨论】:

    标签: swift uilabel swift4 uifont


    【解决方案1】:

    您可以像这样设置系统字体。

    cell.labelName.font = UIFont.systemFont(ofSize: 16)
    

    UIFont(name:size:) 如果字体不可用则返回 nil,这就是为什么什么也没发生。我认为“System - System”不是有效的字体名称。

    【讨论】:

      猜你喜欢
      • 2011-12-18
      • 1970-01-01
      • 2011-09-25
      • 1970-01-01
      • 1970-01-01
      • 2013-02-03
      • 2011-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多