-1

I am retrieving text from Localizable.strings and assigning to label. I can't able to change the label colour. How to do this?

I tried like this way:

self.sampleLabel.text = NSLocalizedString(@"HELLO WORLD", nil);

. i am trying to change label text colour

Arshad Shaik
  • 1,095
  • 12
  • 18
  • What's the code of your tries to change the color ? – Larme Jun 23 '16 at 10:18
  • i tried all the ways how a label colour can be changed using [uiclolor redcolor] method and rgb method everything, as the text is coming from localized.string its not updating. – Arshad Shaik Jun 23 '16 at 10:25
  • You change the Label textColor, not the String color (which doesn't have a color by the way, it's just a list of characters). Or use NSAttributedString, a version of "NSString" that can handle color, and other rendering effects. – Larme Jun 23 '16 at 10:27
  • [self.sampleLabel setTextColor:[UIColor colorWithRed:59/255.0 green:140/255.0 blue:210/255.0 alpha:1]]; and i also used NSAttributedString also but still i am facing the same problem. – Arshad Shaik Jun 23 '16 at 10:28

3 Answers3

0

Is this code doesn't work?

self.sampleLabel.textColor = [UIColor redColor];
self.sampleLabel.backgroundColor = [UIColor blueColor];
Konstantin
  • 861
  • 4
  • 12
0

You have to change label text color, not string color.

self.sampleLabel.textColor = [UIColor redColor];
SebyDrax
  • 66
  • 5
0

Simply do like this:

sampleLabel.textColor = [UIColor colorWithRed:(188/255.f) green:... blue:... alpha:1.0];
Suraj Sukale
  • 1,778
  • 1
  • 12
  • 19