-1

"Time: 6:00 AM"
I have a label with above text. the text "Time:" is static and black in color. Where as the text "6:00 AM" is dynamic and blue in color. I know how to have multiple fonts and colors for a Label when the text is static. But if I have a combination of static and dynamic texts, is it possible to manage multiple fonts and colors through IB ? Or doing it programmatically is the possible solution ?

Thanks

rmaddy
  • 314,917
  • 42
  • 532
  • 579
AUK4SO
  • 301
  • 2
  • 13

2 Answers2

0

Using multiple colours and fonts in an UILabel is quit complicated.But, in your case you can add another label with that, as you are changing the time value in the right side of the first label. keep the first label text as Time: and change the second label text as your dynamic value.

Secondlabel.text = yourstring;
Nazik
  • 8,696
  • 27
  • 77
  • 123
  • I have already done so. Just wanted to know the other possibilities. – AUK4SO Jul 02 '13 at 07:24
  • UILabels can't have more than one colour, if you are using UILabels means use this or you can try `NSAttributedString`(compatible on ios 6) – Nazik Jul 02 '13 at 07:26
0

Using NSMutableAttributedString you can do this .

Here is the link you are looking for.

Change string color with NSAttributedString?

How do you use NSAttributedString?

Community
  • 1
  • 1
Rajneesh071
  • 30,846
  • 15
  • 61
  • 74