tags:

views:

224

answers:

1

Hi all i want to know there a limitation in size for an iphone to display an image? as the resolution of iphone is 320*480 px. i am developing an app which fetches photos from an URL and that URL contains some photos os size > 600KB.So when i launch the app in simulator it behaves properly but in device the application crashes as soon as photos with higher resolution are displayed , and when lower resolution photos are displayed the app does not crash in the device.

A: 

From Apple's doc:

You should avoid creating UIImage objects that are greater than 1024 x 1024 in size. Besides the large amount of memory such an image would consume, you may run into problems when using the image as a texture in OpenGL ES or when drawing the image to a view or layer. This size restriction does not apply if you are performing code-based manipulations, such as resizing an image larger than 1024 x 1024 pixels by drawing it to a bitmap-backed graphics context. In fact, you may need to resize an image in this manner (or break it into several smaller images) in order to draw it to one of your views.

KennyTM