0

I am working on an Iphone application. Is there a way to have multiple colors in the same label or TextView?

What i mean is that I need something like this:

enter image description here

Is there a way to do this without using 3 labels? Because the text might change dynamically and I want to have correct positionning.

Thank you

Y2theZ
  • 10,162
  • 38
  • 131
  • 200

3 Answers3

1

Yes, It's possible to have different style and color in single Label. Have a look at OHAttributedLabel

Also, look at this StackOverFlow Answer.

Community
  • 1
  • 1
Hemang
  • 26,840
  • 19
  • 119
  • 186
1

You can use OHAttributedLabel or CoreTextAttributedLabel

Hemang
  • 26,840
  • 19
  • 119
  • 186
Romit M.
  • 898
  • 11
  • 28
1

In iOS 6 there is a new type of string called NSAttributedString.

You can change colors, fonts, sizes, underline, and almost everything for parts of a string.

Apple Docs

Hemang
  • 26,840
  • 19
  • 119
  • 186
Fogmeister
  • 76,236
  • 42
  • 207
  • 306