NSAttributedString tutorial or help

Discussion in 'iOS Programming' started by wesg, Oct 19, 2010.

  1. wesg macrumors regular

    wesg

    Joined:
    Jan 2, 2008
    Location:
    Toronto, ON
    #1
    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
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    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.
     

Share This Page