Created
August 16, 2017 16:18
-
-
Save boaerosuke/536db8079e6331ba26a12dc80dd01c35 to your computer and use it in GitHub Desktop.
Helper method to scale an uiimage
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
| //helper method to scale uiimage | |
| - (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize { | |
| UIGraphicsBeginImageContextWithOptions(newSize, NO, 1.0); | |
| [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.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