gpt4 book ai didi

swift - UIBarButtonItem 选择/事件时为粗体非标准字体

转载 作者:行者123 更新时间:2023-11-30 14:17:20 25 4
gpt4 key购买 nike

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

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% 可用粗体。

最佳答案

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

customLabel.font = [UIFont boldSystemFontOfSize:16.0f]

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

<小时/>
  • AppleSDGothicNeo-Thin
  • AppleSDGothicNeo-Light
  • AppleSDGothicNeo-Regular
  • AppleSDGothicNeo-Medium
  • AppleSDGothicNeo-SemiBold
  • AppleSDGothicNeo-Bold
  • AppleSDGothicNeo-Medium

关于swift - UIBarButtonItem 选择/事件时为粗体非标准字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30964631/

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