Recently, I was developing objective-C and found that the parameters required to use uicolor in objective-C to generate colors are not the 0-255 and hexadecimal Representation Methods We generally use, it is a decimal representation of 0-1 (for example, uicolor * color = [uicolor colorwithred: 0.79 Green: 0.87 Blue: 0.91 ALPHA: 1, so I used flash to write a conversion tool for use by friends who needed it.
Resend two macros that take color in objective-C:
// RGB color 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 ]
// RGB color macro with alpha
# Define Uicolorfromrgbwithalpha (rgbvalue, A) [uicolor \
Colorwithred :(( Float ) (Rgbvalue & 0xff0000 ) > 16 )) / 255.0 \
Green :(( Float ) (Rgbvalue & 0xff00 ) > 8 )) / 255.0 \
Blue :(( Float ) (Rgbvalue & 0xff )) / 255.0 ALPHA: A]