Created
May 8, 2010 21:11
-
-
Save vl4dimir/394778 to your computer and use it in GitHub Desktop.
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
#import "UIImage+Resizing.h" | |
@implementation UIImage (Resizing) | |
/** | |
* Creates a resized, autoreleased copy of the image, with the given dimensions. | |
* @return an autoreleased, resized copy of the image | |
*/ | |
- (UIImage*) resizedImageWithSize:(CGSize)size | |
{ | |
UIGraphicsBeginImageContext(size); | |
[self drawInRect:CGRectMake(0.0f, 0.0f, size.width, size.height)]; | |
// An autoreleased image | |
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return newImage; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment