Created
October 1, 2012 11:32
-
-
Save MarcoSero/3811090 to your computer and use it in GitHub Desktop.
Objective-C Image Resizing
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)newSize | |
{ | |
//UIGraphicsBeginImageContext(newSize); | |
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.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