I have hex value in mind that I need to implement, working on ipad by the way. Anyways, how can I go about implementing that with objective-c
Help much needed, pleas and thank you!
UIColor's range is from 0 to 1. So you just need to convert the hex color string into decimal, then divide by 255 to get the desired numbers.
For example, if the color is #E0EAF1
:
E0
→ 224, EA
→ 234, F1
→ 241So to create this color, use
UIColor* clr = [UIColor colorWithRed:0.878f green:0.918f blue:0.945f alpha:1];
or let the compiler do the calculation for you:
UIColor* clr = [UIColor colorWithRed:0xE0/255.0f
green:0xEA/255.0f
blue:0xF1/255.0f alpha:1];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With