-
-
Save gotomanners/7977076 to your computer and use it in GitHub Desktop.
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
#import <UIKit/UIKit.h> | |
@interface UIImage (ResizeImage) | |
+ (UIImage *)convertImage:(UIImage *)image toSize:(CGSize)size; | |
@end |
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
#import "UIImage+ResizeImage.h" | |
@implementation UIImage (ResizeImage) | |
+ (UIImage *)convertImage:(UIImage *)image toSize:(CGSize)size | |
{ | |
UIGraphicsBeginImageContext(size); | |
[image drawInRect:CGRectMake(0.0f, 0.0f, size.width, size.height)]; | |
UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return resizedImage; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment