I have an image 1024x1024 and I want resize this image to fit into a tableView Cell. I have used this lines of code:
+ (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize {
//New size is the size of the cell for me
UIGraphicsBeginImageContext(newSize);
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImagePNGRepresentation(img);
UIImage *imgFinal=[UIImage imageWithData:imageData];
return imgFinal;
}
The problem is, when I visualize this image on the screen of Iphone6 or Iphone6+ the image appear blurred and a little bit pixelated. Can you help me?