我使用NSNumberFormatter来显示百分比:
NSNumberFormatter *inclineFormat = [[[NSNumberFormatter alloc] init] autorelease];
[inclineFormat setMinimumFractionDigits:1];
[inclineFormat setNumberStyle:NSNumberFormatterPercentStyle];除了设计团队希望在上标中看到"%“之外,它的工作情况与预期一致。有什么办法可以用NSNumberFormatter来指定吗?
我在iOS设备的UILabel中显示格式化字符串。
发布于 2011-05-20 02:10:59
%在unicode中不作为上标存在。您需要设置所需字符串的格式,不使用%符号,并覆盖较小字体的UILabel以使其显示为上标,或者使用<sup>%</sup>标记在UIWebView中显示内容。Here is a related question。
https://stackoverflow.com/questions/6062696
复制相似问题