These articles often use uicolor, But they encounter many problems. The main problems are the relationship and Conversion Between Custom colors and cicolor and cgcolor.
It took some time to finally figure it out.
1. Use uicolor to display # f6f6f6, a traditional color
# F6f6f6 is a hex RPG color. Therefore, you must first convert it to a 10x color, where F6-240, F6-240, F6-240
Followed by a rowCodeUicolor * testcolor1 = [uicolor colorwithred: 240/255. 0 Green: 240/255. 0 Blue: 240/255. 0 ALPHA: 1];
This article prohibits reprinting on any website and severely condemn the worms.
This article was first published in, blog garden. Please search: blog garden-Find yourself and view the original version Article
IOS uicolor custom color-http://www.cnblogs.com/xunziji/archive/2012/09/27/2706136.html
2. Relationships between uicolor, cicolor, and cgcolor
In different class libraries, the color storage method is actually different. For example, 999 can be stored in hexadecimal, binary, or hexadecimal format.
They can be easily converted, especially many constructors.
3. uicolor defines many static methods, which can be used to conveniently obtain custom colors, such:
Uicolor blackcolor
Uicolor darkgraycolor
Uicolor lightgraycolor
Uicolor whitecolor
Uicolor graycolor
Uicolor redcolor
Uicolor greencolor
Uicolor bluecolor
Uicolor cyancolor
Uicolor yellowcolor
Uicolor magentacolor
Uicolor orangecolor
Uicolor purplecolor
Uicolor browncolor
Uicolor clearcolor
Uicolor lighttextcolor
Uicolor darktextcolor
Uicolor grouptableviewbackgroundcolor
Uicolor viewflipsidebackgroundcolor
Uicolor scrollviewtexturedbackgroundcolor
Uicolor underpagebackgroundcolor
Test code:
//# F6f6f6Uicolor * testcolor1 = [uicolor colorwithred:240/255.0Green:240/255.0Blue:240/255.0ALPHA:1]; Labelcolor. backgroundcolor=Testcolor1;//Testcolor1.cicolor;//Testcolor1.cgcolor;
This article prohibits reprinting on any website and severely condemn the worms.
This article was first published in, blog garden. Please search: blog garden-Find yourself and view the original article
Starting address: IOS uicolor custom color