- (UIImage*)imageWithImageName:(NSString*)nameimageColor:(UIColor*)imageColor {
UIImage *image = [UIImage imageNamed:name];
UIGraphicsBeginImageContextWithOptions(image.size, NO, 0.0f);
[imageColorsetFill];
CGRectbounds =CGRectMake(0,0, image.size.width, image.size.height);
UIRectFill(bounds);
[imagedrawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f];
UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
returntintedImage;
}
对单色icon,及背景为透明起作用
网友评论