2012-02-23 109 views
0

嗨,我有一些图像存储在缓存中。我需要将缓存图像存储在我的目录中。从iPhone中的远程服务器缓存图像

我尝试以下方法EgoImageview及以下两种方法

- (UIImage *) getImage: (NSString *) ImageURLString; 
- (void) cacheImage: (NSString *) ImageURLString; 

但在这个缓存是不正确的方式

随后进行是cache image fn

请代码建议我一些更好的方法

回答

1

试试这个 -

NSString *imgURL = @"imagUrl"; 

NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imgURL]]; 

[imgView setImage:[UIImage imageWithData:data]];