I need to have 19th century in my UILabel. But it should appear as 19th century where the th symbol is a superscript. I am entering the label using plist. How do I ensure that it appears correctly in UI?
Need some guidance on this.
Image attached:
I need to have 19th century in my UILabel. But it should appear as 19th century where the th symbol is a superscript. I am entering the label using plist. How do I ensure that it appears correctly in UI?
Need some guidance on this.
Image attached:
Use Unicode characters ᵗ
(U+1D57) and ʰ
(U+02B0).
You can enter these literally as:
NSString *num = @"19 ᵗʰ";
or:
NSString *num = @"19\u1d57\u02b0";
If those don't look nice enough, using an NSAttributedString
would be best.
NSAttributedString has a property for that on osx, so perhaps it will be available on ios7. for now you could either store html in your plist and display that, or store 2 strings '19' and 'th' and manually add two uilabels into the top level one and manually layout them to create the superscript effect.