简体   繁体   中英

How do I display the character for 1/2 in an NSString in iOS?

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

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

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

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 = @"½"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM