How to resize the image programmatically in objective-c in iphone
image, iphone, objective-c
Solution
Please find the following code.
- (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size {
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *destImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return destImage;
}
Problem
I have an application where I am displaying large images in a small space. The images are quite large, but I am only displaying them in 100x100 pixel frames. My app is responding slowly because of the size fo the images I am using. To improve performance, how can I resize the images programmatically using Objective-C?