Skip to content

Instantly share code, notes, and snippets.

@jrturton
Created July 31, 2013 10:49
Show Gist options
  • Save jrturton/6121088 to your computer and use it in GitHub Desktop.
Save jrturton/6121088 to your computer and use it in GitHub Desktop.
Tint mono image
-(UIImage*)tintedMonoImageWithColor:(UIColor*)color
{
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f);
[color setFill];
CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);
UIRectFill(bounds);
[self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0];
UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return tintedImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment