Last active
April 4, 2016 07:35
-
-
Save mbelsky/275e700dc6ef56c9bc81388016872c71 to your computer and use it in GitHub Desktop.
Redraw an image for new size
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
UIImage *image = [[UIImage alloc] initWith: something]; | |
if (image.size.width != kAppIconSize || image.size.height != kAppIconSize) { | |
CGSize itemSize = CGSizeMake(kAppIconSize, kAppIconSize); | |
UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0.0f); | |
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height); | |
[image drawInRect:imageRect]; | |
self.appRecord.appIcon = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment