UIColor

UIColor管理颜色

 

使用三原色生成颜色:

UIColor *color = [UIColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:1.0];
l  0.0~1.0
l  透明度0.0~1.0

使用已有颜色生成颜色:

UIColor *color = [UIColor whiteColor];
color = [color colorWithAlphaComponent:0.5]; // 指定透明度

                            

使用已有的型生成:

UIColor *color = [UIColor groupTableViewBackgroundColor];

 

添加UIView的背景图片: (UIColor方法浪费内存,建议不适用)

UIImage *hogeImage = [UIImage imageNamed:@"hoge.png"];
UIColor *color = [[UIColor alloc] initWithPatternImage:hogeImage];

// 最好使用UIImageView来添加UIView的背景图


已有颜色 :

 

blackColor
blueColor
brownColor
clearColor
cyanColor
darkGrayColor
grayColor
greenColor
lightGrayColor
magentaColor
orangeColor
purpleColor
redColor
whiteColor
yellowColor


已有型 :

lightTextColor

darkTextColor 

groupTableViewBackgroundColor

viewFlipsideBackgroundColor

scrollViewTexturedBackgroundColor




【原文:http://blog.sina.com.cn/s/blog_6268f10201015c54.html】


 

你可能感兴趣的:(UIColor)