【问题标题】:UIBarButtonItem bold non-standard font when selected/active选中/激活时 UIBarButtonItem 粗体非标准字体
【发布时间】:2015-06-21 12:44:41
【问题描述】:

我想设置 UIBarButtonItem 以便它在我的应用程序中使用不同的字体。我正在使用appearance 执行此操作,但是我遇到了一个问题,即在选择时如何以 bold 显示字体。这是我想做的:

var barButtonItemApperance = UIBarButtonItem.appearance()
barButtonItemApperance.setTitleTextAttributes([NSFontAttributeName : UIFont(name: "Apple SD Gothic Neo", size: 16)!], forState: UIControlState.Normal)
barButtonItemApperance.setTitleTextAttributes([NSFontAttributeName : UIFont(name: "Apple SD Gothic Neo", size: 16)!], forState: UIControlState.Selected) // I want this to be in bold text

有谁知道我如何做到这一点?该字体绝对是 100% 可用的粗体。

【问题讨论】:

    标签: swift ios8 uibarbuttonitem uiappearance


    【解决方案1】:

    为了使文本加粗,这是一般语法:

    customLabel.font = [UIFont boldSystemFontOfSize:16.0f]
    

    但你可以简单地选择字体的粗体版本Apple SD Gothic Neo,下面是列表:


    • AppleSDGothicNeo-Thin
    • AppleSDGothicNeo-Light
    • AppleSDGothicNeo-Regular
    • AppleSDGothicNeo-Medium
    • AppleSDGothicNeo-SemiBold
    • AppleSDGothicNeo-Bold
    • AppleSDGothicNeo-Medium

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-21
      • 2013-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多