diff options
Diffstat (limited to 'Juick/Helpers/UIImage+Utils.m')
-rw-r--r-- | Juick/Helpers/UIImage+Utils.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Juick/Helpers/UIImage+Utils.m b/Juick/Helpers/UIImage+Utils.m index 4617c65..c209bcf 100644 --- a/Juick/Helpers/UIImage+Utils.m +++ b/Juick/Helpers/UIImage+Utils.m @@ -66,4 +66,18 @@ return img; } ++(UIImage *) placeholderImageWithColor:(UIColor *)color size:(CGSize)size { + CGRect rect = (CGRect){ + .origin = CGPointZero, + .size = size + }; + UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0f); + [color setFill]; + UIRectFill(rect); + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return [[self alloc] initWithCGImage:[image CGImage]]; +} + @end |