diff options
author | Vitaly Takmazov | 2017-10-15 23:47:11 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-10-15 23:47:11 +0300 |
commit | 8ae952ec8df2a713afeaef5960a88888e050c6fc (patch) | |
tree | b7b09deed573336e5d274eed790c30ba57e4a910 /Juick/Helpers/UIImage+Utils.m | |
parent | 6499148cb3f62e20534b62c181125ebeacfa3438 (diff) |
WIP
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 |