Created
February 12, 2016 11:24
-
-
Save MaximAlien/15f7ae5979e545a9b904 to your computer and use it in GitHub Desktop.
[iOS] Create new image with different 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 *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)size | |
{ | |
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); | |
[image drawInRect:CGRectMake(0, 0, size.width, size.height)]; | |
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return newImage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment