#pragma mark -- handle image
-(UIImage *)getImageWithAlpha:(CGFloat)alpha{
UIColor *color=[UIColor colorWithRed:1 green:0 blue:0 alpha:alpha];
CGSize colorSize=CGSizeMake(1, 1);
UIGraphicsBeginImageContext(colorSize);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, color.CGColor);
CGContextFillRect(context, CGRectMake(0, 0, 1, 1));
UIImage *img=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
网友评论