Superscript cents in an attributed string

You have to use NSBaselineOffsetAttributedName.

From the doc:

NSBaselineOffsetAttributeName
The value of this attribute is an
NSNumber object containing a floating point value indicating the
character’s offset from the baseline, in points. The default value is
0.
Available in iOS 7.0 and later.

From your example:

[buyString addAttribute:NSBaselineOffsetAttributeName
                  value:@(10.0)
                  range:NSMakeRange(2, buyString.length - 2)];

You may have to change the value to fit your needs.

Leave a Comment