I want to change the background color of my label with a variable how can I do that ?
This is my code but I'd like to have a variable instead of 'redColor'
[publisherLabel setBackgroundColor:[UIColor redColor]];
I want to change the background color of my label with a variable how can I do that ?
This is my code but I'd like to have a variable instead of 'redColor'
[publisherLabel setBackgroundColor:[UIColor redColor]];
Variable with color from an RGBA value.
UIColor *myColor = [UIColor colorWithRed:100.0/255.0 green:101.0/255.0 blue:102.0/255.0 alpha:1.0]];
You can also use HEX if you want:
#define HEXCOLOR(c) [UIColor colorWithRed:((c>>24)&0xFF)/255.0
green:((c>>16)&0xFF)/255.0
blue:((c>>8)&0xFF)/255.0
alpha:((c)&0xFF)/255.0];
// usage:
UIColor* c = HEXCOLOR(0xff00ffff);