UIColor 颜色设置[[UIColor greenColor] set].....

来源:互联网 发布:李彦宏回应阳泉云计算 编辑:程序博客网 时间:2024/05/22 05:33


转载:http://www.t262.com/read/36446.html

篇一 : UIColor 详解

1 UIColor *white1 = [UIColor whiteColor]; // 白色2 UIColor *white2 = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];  // 白色3 UIColor *orange = [UIColor colorWithRed:1.0 green:0.5 blue:0.0 alpha:1.0];  // 橙色
4 UIColor *imageColor = [UIColor colorWithPatternImage:image];          // 根据图片生成颜色

5 [[UIColor blackColor] setStroke];    // 设置边框颜色
6 [[UIColor blueColor] setFill];      // 设置背景填充色
7 [[UIColor greenColor] set];        // 设置字符颜色



篇二 : 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的背景图

已有颜色:

blackColorblueColorbrownColorclearColorcyanColordarkGrayColorgrayColorgreenColorlightGrayColormagentaColororangeColorpurpleColorredColorwhiteColoryellowColor

已有型:

lightTextColor

darkTextColor

groupTableViewBackgroundColor

viewFlipsideBackgroundColor

scrollViewTexturedBackgroundColor


原创粉丝点击