开发者

Display superscript % using NSNumberFormatter

开发者 https://www.devze.com 2023-03-06 22:09 出处:网络
I\'m using an NSNumberFormatter to displa开发者_开发知识库y a percentage: NSNumberFormatter *inclineFormat = [[[NSNumberFormatter alloc] init] autorelease];

I'm using an NSNumberFormatter to displa开发者_开发知识库y a percentage:

NSNumberFormatter *inclineFormat = [[[NSNumberFormatter alloc] init] autorelease];
[inclineFormat setMinimumFractionDigits:1];
[inclineFormat setNumberStyle:NSNumberFormatterPercentStyle];

It's working as expected with the exception that the design team would like to see the "%" in superscript. Is there anyway to specify that using NSNumberFormatter?

I'm displaying the formatted string in a UILabel in iOS devices.


% does not exist in unicode as a superscript. You will need to format the string that you want with out a % sign and overlay a smaller font UILabel to make it appear as a superscript or display the contents in a UIWebView using <sup>%</sup> tags. Here is a related question.

0

精彩评论

暂无评论...
验证码 换一张
取 消