iOS学习笔记-UIColor分类

建立分类
UIColor+SetRGB

UIColor+SetRGB.h

#import 

@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

你可能感兴趣的:(iOS学习笔记-UIColor分类)