Created
February 4, 2013 19:05
-
-
Save mikekatz/4708775 to your computer and use it in GitHub Desktop.
Create a simple colored square image. From my UI utils repo https://github.com/mikekatz/iOS-UI-Utils
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*) imageWithColor:(UIColor*)color size:(CGSize)size | |
{ | |
UIGraphicsBeginImageContext(size); | |
UIBezierPath* rPath = [UIBezierPath bezierPathWithRect:CGRectMake(0., 0., size.width, size.height)]; | |
[color setFill]; | |
[rPath fill]; | |
UIImage* image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment