0

I want to change all my text color with my own colorcode value(#003366).

I know this about it-

myLabel.textColor = [UIColor whiteColor];

but instead of white color I want #003366 (blue)

How to do it in iphone?

Luke
  • 11,426
  • 43
  • 60
  • 69
BBDev
  • 147
  • 1
  • 4

2 Answers2

2
//would be pale red
myLabel.textColor = [UIColor colorWithRed:1.0f green:0.8f blue:0.8f alpha:1.0f];
James Webster
  • 31,873
  • 11
  • 70
  • 114
1

Define this code as macro,

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

and then

myLabel.textColor = UIColorFromRGB(0x003366);
Dhruv
  • 2,153
  • 3
  • 21
  • 45