Created
March 10, 2014 08:38
-
-
Save mamaz/9461489 to your computer and use it in GitHub Desktop.
This file contains 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
// Create a generated tiny UIImage with color | |
// Created not by me. | |
- (UIImage *)imageWithColor:(UIColor *)color | |
{ | |
CGRect rect = CGRectMake(0, 0, 1, 1); | |
// Create a 1 by 1 pixel context | |
UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0); | |
[color setFill]; | |
UIRectFill(rect); // Fill it with your color | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment