Created
          July 31, 2013 10:49 
        
      - 
      
- 
        Save jrturton/6121088 to your computer and use it in GitHub Desktop. 
    Tint mono image
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -(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