This is the briefest of brief posts dealing with Core Text and NSAttributedStrings in Xcode for iOS. First, let's create an attributed string and add a superscript attribute along with a font. NSMutableAttributedString *stringOfText = [[NSMutableAttributedString alloc] initWithString:@"Hello World"]; [stringOfText addAttributes:@{(id < NSCopying >)kCTSuperscriptAttributeName:[NSNumber numberWithInt:1], NSFontAttributeName:[UIFont fontWithName:@"Georgia" size:20]} range:NSMakeRange(2,5)]; We now have a range of options. We could: draw the string directly inside the drawRect method of a UIView use a CATextLayer use a UILabel (iOS 6 onwards) use a UITextView (iOS 7 onwards) Explaining how to draw the string in the drawRect of a UIView is a post in its own right, so here I'll move swiftly on to look first at the CATextLayer option. You'd add an attributed string to a CATextLayer like this: CATextLayer *layerForText = [[CATextLay
Technology tips for writers, editors, designers, illustrators, programmers and publishers, and now Retro Gamers.