PDA

View Full Version : UILabel with attributes / range?




Darkroom
Aug 16, 2009, 11:43 AM
for alignment purposes i need to create one (and only one) UILabel, but that label needs to contain different type faces and sizes. however, i've read that NSAttributedString is not available for iPhone. is it possible to have one label with different attributes some other way?



PhoneyDeveloper
Aug 16, 2009, 11:52 AM
Using the SDK, the answer is No. UILabel allows only one 'style.' The only way to get multiple styles is UIWebView.

The ThreeTwenty classes have a styled label class that might work for you.

http://groups.google.com/group/three20?lnk=srg

North Bronson
Aug 16, 2009, 11:56 AM
Assuming a compact UIWebView is inappropriate, my ideas are:

Multiple UILabels stacked together

Custom drawing with the UIKit String Drawing methods.

Custom drawing with Core Graphics.