Skip to content

Instantly share code, notes, and snippets.

@jeksys
Created May 5, 2011 13:43
Show Gist options
  • Save jeksys/957049 to your computer and use it in GitHub Desktop.
Save jeksys/957049 to your computer and use it in GitHub Desktop.
imageScaledToSize
@interface UIImage (TPAdditions)
- (UIImage*)imageScaledToSize:(CGSize)size;
@end
@implementation UIImage (TPAdditions)
- (UIImage*)imageScaledToSize:(CGSize)size {
UIGraphicsBeginImageContext(size);
[self drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment