Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wesg

macrumors regular
Original poster
I'm trying to integrate sub and super script text into my UILabels for an application. I've read that NSAttributedString can help solve the problem but have yet to find a clear tutorial or help file.

Can anyone point me in the direction of something that might help or even provide sample code?

Here's pseudo code to do what I'm thinking:
Code:
NSAttributedString alloc with string
assign subscript attribute to characters in range 1 - end
assign superscript attribute to characters that require it
display the new string in the label
 
AFAIK, there's no way to use NSAttributedString with UILabel. NSAttributedString is a container class for strings and formatting but to draw the string on iOS you need to use Core Text.

I suggest searching the Apple iOS forum for more info.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.