Color settings:
Specify RGB, the number of parameters is red, green, yellow, transparency, the range is 0-1
+ (Uicolor *) colorwithred: (cgfloat) Red Green: (cgfloat) Green Blue: (cgfloat) Blue Alpha: (cgfloat) Alpha;
Specify HSB, number of parameters: Hue (hue), saturated (saturation), brightness (brightness)
+ (Uicolor *) Colorwithhue: (cgfloat) Hue saturation: (cgfloat) saturation brightness: (cgfloat) Brightness alpha: (CGFloat ) Alpha;
The color after which the current color changes transparency:
Uicolor *color = [Uicolor Redcolor]; Uicolor *CL = [color colorwithalphacomponent:0.5f];
Define a color value of 255 and turn 255 to 0-1
CGFloat R = (cgfloat) 225/255.0; CGFloat G = (cgfloat) 66/255.0; CGFloat B = (cgfloat) 88/255.0; CGFloat alpha = (cgfloat) 1.0; Uicolor *mycolorrgb = [Uicolor colorwithred:r green:g blue:b alpha:alpha ]; Self.tableView.backgroundColor = Mycolorrgb;
Finally attached
Uicolor Official API Documentation:
Creating a uicolor Object from Component Values
+ colorWithWhite:alpha:
+ colorWithHue:saturation:brightness:alpha:
+ colorWithRed:green:blue:alpha:
+ colorWithCGColor:
+ colorWithPatternImage:
+ colorWithCIColor:
– colorWithAlphaComponent:
Initializing a Uicolor Object
– initWithWhite:alpha:
– initWithHue:saturation:brightness:alpha:
– initWithRed:green:blue:alpha:
– initWithCGColor:
– initWithPatternImage:
– initWithCIColor:
Creating a uicolor with Preset Component Values
+ blackColor
+ darkGrayColor
+ lightGrayColor
+ whiteColor
+ grayColor
+ redColor
+ greenColor
+ blueColor
+ cyanColor
+ yellowColor
+ magentaColor
+ orangeColor
+ purpleColor
+ brownColor
+ clearColor
iOS Development--color settings