title: iOS Colorizing an Image Turns it Black
body: <p>I have this method which I created after hooking into SBAwayView:</p>
  
  <pre><code>- (UIImage *) colorizeImage:(UIImage *)img color:(UIColor *)color{
  
      NSString *name = @"badge.png";
      UIImage *img = [UIImage imageNamed:name];
  
      UIGraphicsBeginImageContext(img.size);
  
      CGContextRef context = UIGraphicsGetCurrentContext();
  
      [color setFill];
  
      CGContextTranslateCTM(context, 0, img.size.height);
      CGContextScaleCTM(context, 1.0, -1.0);
  
      CGContextSetBlendMode(context, kCGBlendModeColorBurn);
      CGRect rect = CGRectMake(0, 0, img.size.width, img.size.height);
      CGContextDrawImage(context, rect, img.CGImage);
  
      CGContextClipToMask(context, rect, img.CGImage);
      CGContextAddRect(context, rect);
      CGContextDrawPath(context,kCGPathFill);
  
      UIImage *coloredImg = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
  
      return coloredImg;
  }
  </code></pre>
  
  <p>But when I send it the color</p>
  
  <pre><code>[[UIColor alloc] initWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
  </code></pre>
  
  <p>and an image it just returns it as completely blackened!</p>