iOS学习笔记-UIColor分类
2018-04-18 本文已影响0人
leyal
建立分类
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