views:

148

answers:

3

Hi!I am using apple standard code for scrolling+zooming+paging after 10 image scrolling and paging my console gives Memory Warning Level-1,Then Memory Warning Level-2 and then crash how can i stop crash my application?Please help me.I have taken this code from http://developer.apple.com/library/ios/#samplecode/PhotoScroller/Introduction/Intro.html

+1  A: 

Did you implement the -(void)didReceiveMemoryWarning ? You can release every images that you don't use at this moment.

Keeping all images in an array will prevent you of doing this. Instead, you should create a method that gives you the right image based on its index (like an array) but that manages a cache (i.e. using an array) that you can clean when memory warnings are issued. Also I don't know this sample project by heart but I guess that they use only three controls to display image on the left, current image and image on the left. If not, be sure that other views are released when not useful for display.

VdesmedT
Actually i have an arrary of 10 images and inthis viewcontroller i am providing paging and zooming all that 10 images so i can't release any image in this method because i have array and in that array i have names of all 10 images and i displayed all images one by one.
Ankit Vyas
You can release any image that you aren't currently displaying in the visible part of a view (whether you think you can or not).
hotpaw2
A: 

It seems the images you use is of greater size.Try to reduce the pixel size and use it.

All the Best.

Warrior
i can't do it because it's our application's requirement to show user high resolution images.my image resolution is 640x960 so please give me an alternative solution.thanks for your valuable response.
Ankit Vyas
A: 

Each big image must be treated as a set of tiles and load data from the ONLY tile or set of tiles which is / are currently being displayed on the screen.

I dont know exactly how this works but you can google for it, I guess.

Raj