//Xcode5.0系统中UIColor有这么几种关于UIColor的方法,我们简单介绍几种方法的用途。
UILabel * lable = [[UILabel alloc]initWithFrame:CGRectMake(100, 100, 30, 30)];
lable.backgroundColor = [UIColor redColor];
[self.view addSubview:lable];
/*
+ (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha;
+ (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha;
+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
+ (UIColor *)colorWithCGColor:(CGColorRef)cgColor;
+ (UIColor *)colorWithPatternImage:(UIImage *)image;
*/
//直接赋值
lable.backgroundColor = [UIColor redColor];
//用RGB颜色自己定制颜色,alpha是透明度
lable.backgroundColor = [UIColor colorWithRed:225 green:215 blue:0 alpha:1];
//用图片作为lable的颜色,
lable.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"2.png"]];
//这里的新问题就是图片的大小怎么设置
//直接设置lable的大小
UILabel * lable1 = [[UILabel alloc]initWithFrame:CGRectMake(100, 100, 30, 30)];
//将lable设置为背景的大小
//方法1
UILabel * lable2 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0,self.view.bounds.size.width,self.view.bounds.size.height) ];
//方法2
UILabel * lable3 = [[UILabel alloc]initWithFrame:[UIScreen mainScreen].bounds];
帮助:苹果电脑中自带RGB识别软件:数码测色计