- (UIImage *)drawTabbarItemBackgroundImageWithSize:(CGSize)size withColorWithRed:(CGFloat)red Green:(CGFloat)green Blue:(CGFloat)blue{
//准备绘图环境
UIGraphicsBeginImageContext(size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(ctx, red/255, green/255, blue/255, 1);
CGContextFillRect(ctx, CGRectMake(0, 0, size.width, size.height));
//结束绘图
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
网友评论