hi,
we can scale the UIImage to any size using the follwing method
add this code to your .h file
add the following to .m file
e.g to resize an image
we can scale the UIImage to any size using the follwing method
add this code to your .h file
@interface UIImage (INResizeImageAllocator) + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; - (UIImage*)scaleImageToSize:(CGSize)newSize; @end
add the following to .m file
@implementation UIImage (INResizeImageAllocator) + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; { UIGraphicsBeginImageContext( newSize ); [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; } - (UIImage*)scaleImageToSize:(CGSize)newSize { return [UIImage imageWithImage:self scaledToSize:newSize]; }
e.g to resize an image
self.resizeimage = [UIImage imageWithImage:actual_image scaledToSize:CGSizeMake(65.0f, 65.0f)];