Skip to content

Instantly share code, notes, and snippets.

@jrturton
Created July 31, 2013 10:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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