IOS uicolor custom color

Source: Internet
Author: User

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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.