Skip to content

Instantly share code, notes, and snippets.

@atomkirk
Created October 2, 2013 17:12
Show Gist options
  • Save atomkirk/6797052 to your computer and use it in GitHub Desktop.
Save atomkirk/6797052 to your computer and use it in GitHub Desktop.
Sometimes you just need an empty image...
// Create hidden image since we can't hide/set nil the image for the search field
UIGraphicsBeginImageContext(self.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);
CGContextFillRect(context, CGRectMake(0, 0, self.frame.size.width, self.frame.size.height));
UIImage *blankImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment