gpt4 book ai didi

xcode - 在 Xcode 的 UILabel 中显示货币符号

转载 作者:行者123 更新时间:2023-12-02 06:37:42 25 4
gpt4 key购买 nike

我正在尝试使用 html 格式或 unicode 格式显示货币的字形。通过使用前者,我尝试了各种操作,包括:stringWithUTF8StringdecodeFromPercentEscapeStringCFURLCreateStringByReplacingPercentEscapesUsingEncodingstringByReplacingPercentEscapesUsingEncoding 但都没有他们成功地将 € 变成了欧元符号。使用 Unicode 这个问题稍微好一点:

NSString *aStr = [NSString stringWithUTF8String:[@"\u20ac" UTF8String]];

实际上打印了一个欧元符号,但出于我的原因我不明白,如果我提供字符串作为方法的结果,则会显示 unicode 代码。

在 UILbel 中显示欧元、美元或英镑符号的标准方式是什么?

最佳答案

UILabel 自动解析 unicode 字符串,无需解码:

label.text = @"\u0024"; // dollar
label.text = @"\u20ac"; // euro

引用fileformat.info用于编码名称。

关于xcode - 在 Xcode 的 UILabel 中显示货币符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14539377/

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