【问题标题】:Caching Images From Remote Server in iphone [closed]在iphone中缓存来自远程服务器的图像[关闭]
【发布时间】:2012-03-13 20:34:21
【问题描述】:

您好,我有一些图像存储在缓存中。我需要将缓存图像存储在我的目录中。

我尝试了以下方法EgoImageview和以下两种方法

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

但是在这种情况下,缓存没有以正确的方式工作

以下是cache image fn的代码

请给我一些更好的方法

【问题讨论】:

    标签: iphone objective-c ios caching uiimageview


    【解决方案1】:

    试试这个 -

    NSString *imgURL = @"imagUrl";
    
    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imgURL]];
    
    [imgView setImage:[UIImage imageWithData:data]];
    

    【讨论】:

      猜你喜欢
      • 2017-04-26
      • 2014-10-27
      • 1970-01-01
      • 2011-03-02
      • 2012-08-17
      • 2011-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多