1

how to do the formatting in a UILabel ? for exemple , if i want to make this , Connected as Keving G , "connected as" and "kevin g" have différents colors and size . Should i use 2 UIlabel ?

Keviin55
  • 117
  • 3
  • 11
  • 1
    Take a look here: https://github.com/wader/ios-misc/tree/master/CoreTextLabel maybe could helps you. – Mat Nov 29 '11 at 11:54

4 Answers4

4

There's another potential solution, but these might be too complicated for your purposes.

You can use a open source solution like OHAttributedLabel (which uses a NSAttributedString) or a CATextLayer which takes a NSAttributedString as well.

I got these answers from this related question (which includes sample code for OHAttributedLabel).

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
1

You have to use two labels and set font accordingly.

hypercrypt
  • 15,389
  • 6
  • 48
  • 59
Srinivas
  • 983
  • 9
  • 21
0

You can't do that with a UILabel.

One option is to use a UIWebView and stick HTML inside it...

tarmes
  • 15,366
  • 10
  • 53
  • 87
0

TTStyledLabel can be used from three20 library

Denis
  • 6,313
  • 1
  • 28
  • 27