使用AsyncImageView
類here。在文檔中他們說「默認情況下,所有加載的圖像都被緩存」。你可以在文檔的最後一段看到它。AsyncImageView沒有緩存圖像
但問題是,當我嘗試重新加載圖像它帶有佔位符,等待幾秒鐘,從URL再次甚至它已經被成功加載上次加載圖像。
這意味着它沒有被緩存,對吧?
所以嗯問我的代碼是否有問題?
爲什麼圖像不像使用SDWebImage
那樣被緩存?
這是我的代碼:
AsyncImageView *imageView = [[AsyncImageView alloc] initWithFrame:CGRectMake(0, 0, productCellWidth, productCellHeight)];
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.clipsToBounds = YES;
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:ProductPicture]];
[AsyncImageLoader defaultCache];
[[AsyncImageLoader sharedLoader]loadImageWithURL:URL target:self success:@selector(successSelector) failure:@selector(failureSelector)];
「緩存將繼續建設,直到內存警告被觸發。」你是否觸發過內存警告? – sunkehappy