581Resizing an UIImage
Nice and simple Category to resize an UIImage
@interface UIImage (Resize)
- (UIImage*)scaleToSize:(CGSize)size;
@end
#import "UIImageResize.h"
#import
@implementation UIImage (Resize)
- (UIImage*)scaleToSize:(CGSize)size {
UIGraphicsBeginImageContext(size);
[self drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
@end