开发者

large image size problems

I am loading images of size 1800x1300 in UIImage.(getting the images from server..)then i am adding that images into Uiscrollview.while scrolling my imag开发者_运维知识库es ,the app getting crashed.is it a the image size issue.....?thanks in advance.


UIImage *image = [UIImage imageNamed:@"image.png"]; 
NSData *imgData = UIImageJPEGRepresentation([UIImage imageWithCGImage:[image CGImage]],0.5);
UIImage *compressedImage = [UIImage imageWithData:mgData];


You should definitely scale your images down, significantly, especially for the iPhone screen size.

You should also compress your images as much as you can without affecting the quality. Your image, I am assuming is somewhere around 1.5MB - 2MB, so that will use up an extreme amount if memory, and cause your device to crash every time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜