我有以下XML解析的endElement方法加载图像从URL代码:加载图像到缓存
food.image=strVal;
NSData *data=[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:strVal]];
UIImage *image=[[UIImage alloc]initWithData:data];
food.myImage=image;
虽然我使用的应用程序的结束这个加载的图像,我的应用程序必须等到所有图像被加载。我应该在这里使用缓存,但我很困惑如何在这个应用程序中使用缓存。有没有其他方法?
我真的可以建议你看一看[AFNetworking](https://github.com/AFNetworking/AFNetworking/ )他们在UIImageView上加载了一个很好的扩展来加载和缓存图像。 – rckoenes
试试这个: http://stackoverflow.com/questions/2149929/how-to-know-when-nsdatas-initwithcontentsofurl-has-finished-loading – sachin