Take the 2-minute tour ×

My Requirment is need to show the 4000 x 2000 image in UIImageView, but i displayed this image in UIImageView... I Received memory warning after that some navigation app crash.. Could anyone please suggest me how to get rid that problem.. And yes i dont want to resize that images

share|improve this question
add comment

2 Answers

You should use a CATiledLayer. See Apples PhotoScroller for a sample implementation.

share|improve this answer
My requirement to use ios 4..not able to run it. –  Sachin Oct 22 '12 at 10:05
CATiledLayer is available since iOS2, the worst bugs were fixed in iOS4. Only the example requires iOS6, but you don't have to copy the sample verbatim. –  Matthias Bauch Oct 22 '12 at 11:45
Thanks Matthias i got it. –  Sachin Oct 22 '12 at 11:47
add comment

try with this code, it may solve your problem

     CGSize initialImageSize = userimage.frame.size;

     CGSize imageSize = userimage.image.size;
     CGFloat aspectRatio = imageSize.width / imageSize.height;

     CGRect imageFrame = userimage.frame;

     if (initialImageSize.width / aspectRatio <= initialImageSize.height) {
     imageFrame.size.width = initialImageSize.width;
     imageFrame.size.height = imageFrame.size.width / aspectRatio;
     } else {
     imageFrame.size.height = initialImageSize.height;
     imageFrame.size.width = imageFrame.size.height * aspectRatio;
     userimage.frame = imageFrame;

where userimage is UIImageView where you load your image.

share|improve this answer
Requirment is that need to display image in UIImageView without cropping without adjusting... just show it whatever size of the UIImage –  Sachin Oct 22 '12 at 10:46
you have to resize image in proper ratio ,other wise your application gets crash. your image size is 4000,2000. it's too big size. –  shraddha hattimare Oct 22 '12 at 10:55
add comment

Your Answer


