views:

44

answers:

1

hi all.

I am having about 60 different images coming from the webservice.And I am storing it in a NSMutablearray.

now when I load the image for the very first time , each image will consume about 0.5 to 1.5 mb of space of iPad. As I do have multiple images the memory consumption reaches very high and then application gets crashed.

I am showing image in an image view by clicking on a button.

Can any one suggest me how to menage such an memory issue so that application will not be crashed.

thanks in advance.

+1  A: 

I would store the image to the apps cache & then read them back from the cache when you need them.

NSString *cachesDirectoryPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];    
NSLog(@"cachesDirectoryPath: %@", cachesDirectoryPath);

or save yourself the heartache & use ASIHTTPRequest - http://allseeing-i.com/ASIHTTPRequest/

& get a bit more than just caching thrown in.

gef