gpt4 book ai didi

swift - 在swift中查找系统字体中的unicode字符以在按钮中设置属性标题

转载 作者:行者123 更新时间:2023-11-30 10:47:37 25 4
gpt4 key购买 nike

我正在做 cs193p,为了我的家庭作业,我需要调整仅在系统字体中可用的 unicode 字符。如何在 Xcode 中找到这些 un​​icode 字符,并将它们设置为 UI 按钮上的属性标题。

最佳答案

您可以将 unicode 字符设置为按钮标题,例如:

@IBOutlet weak var testButton: UIButton!
// ...

override func viewDidLoad() {
super.viewDidLoad()
testButton.setTitle("😄", for: UIControlState.normal)
}

如果您有特定的 unicode,您可以尝试:

testButton.setTitle(String("\u{20e0}"), for: UIControlState.normal)

希望这可以帮助你。

关于swift - 在swift中查找系统字体中的unicode字符以在按钮中设置属性标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55423194/

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