开发者

ipad: Image loading and Memory management problem & crash of the app

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 imag开发者_如何学Ces 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.


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜