- (
UIImage
*) tintImageWithColor:(
UIColor
*)tintColor
{
UIGraphicsBeginImageContextWithOptions ( self . size , NO , [[ UIScreen mainScreen ] scale ]);
CGContextRef context = UIGraphicsGetCurrentContext ();
CGContextTranslateCTM (context, 0 , self . size . height );
CGContextScaleCTM (context, 1.0 , - 1.0 );
CGRect rect = CGRectMake ( 0 , 0 , self . size . width , self . size . height );
CGContextSetBlendMode (context, kCGBlendModeNormal );
CGContextDrawImage (context, rect, self . CGImage );
CGContextSetBlendMode (context, kCGBlendModeSourceIn );
[tintColor setFill ];
CGContextFillRect (context, rect);
UIImage *coloredImage = UIGraphicsGetImageFromCurrentImageContext ();
UIGraphicsEndImageContext ();
return coloredImage;
{
UIGraphicsBeginImageContextWithOptions ( self . size , NO , [[ UIScreen mainScreen ] scale ]);
CGContextRef context = UIGraphicsGetCurrentContext ();
CGContextTranslateCTM (context, 0 , self . size . height );
CGContextScaleCTM (context, 1.0 , - 1.0 );
CGRect rect = CGRectMake ( 0 , 0 , self . size . width , self . size . height );
CGContextSetBlendMode (context, kCGBlendModeNormal );
CGContextDrawImage (context, rect, self . CGImage );
CGContextSetBlendMode (context, kCGBlendModeSourceIn );
[tintColor setFill ];
CGContextFillRect (context, rect);
UIImage *coloredImage = UIGraphicsGetImageFromCurrentImageContext ();
UIGraphicsEndImageContext ();
return coloredImage;
}