如何在 iOS 中显示 NSString 中的 1/2 字符?

发布于 12-20 07:55 字数 72 浏览 3 评论 0原文

我正在开发一个 iOS 应用程序,我想将小数值 1/2 作为 NSString 中的单个字符放置在 UILabel 中,这可能吗?

I'm working on an application for iOS in which I would like to place the fractional value 1/2 as a single character within an NSString for use in an UILabel, is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心房敞2024-12-27 07:55:23

尝试将标签的文本属性设置为 1/2 的 Unicode:

label.text = [NSString stringWithFormat:@"%C",0x00bd];

Try setting the label's text property to the Unicode of 1/2:

label.text = [NSString stringWithFormat:@"%C",0x00bd];
忆梦2024-12-27 07:55:23

您可以简单地使用 Mac OS 的内置字符查看器: http://docs.info.apple.com/article.html?path=Mac/10.6/en/8164.html

所以你可以这样做 label.text = @"½"

You can simply use Mac OS's built-in character viewer: http://docs.info.apple.com/article.html?path=Mac/10.6/en/8164.html

So you can just do label.text = @"½"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文