建立分类
UIColor+SetRGB
UIColor+SetRGB.h
#import <UIKit/UIKit.h>
@interface UIColor (SetRGB)
//-(void)setRGB:Red:(CGFloat)r Green:(CGFloat) g Blue:(CGFloat) b;
+(UIColor *)RGB:(CGFloat)r andG:(CGFloat)g andB:(CGFloat)b alpha:(CGFloat) alp;
@end
UIColor+SetRGB.m
#import "UIColor+SetRGB.h"
@implementation UIColor (SetRGB)
+(UIColor *)RGB:(CGFloat)r andG:(CGFloat)g andB:(CGFloat)b alpha:(CGFloat) alp
{
UIColor * color = [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:alp];
return color;
}
@end