我正在使用SDWebImage庫來處理圖像緩存。我實現了其中一種方法從服務器下載圖像並在tableView
中填充數據。這裏是我的下載圖像和tableViewCell
顯示cellForRowAtIndexPath
代碼,我做了下面的代碼SDWebImage不更新緩存中的圖像
[cell.profileImageView sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil options:SDWebImageRefreshCached];
它完美地在這裏。但是當我在服務器上更新映像時,tableViewCell
仍然顯示相同的圖像。問題是,它的緩存沒有更新映像。我搜索了相同的關鍵字,並且在StackOverflow上遇到了this問題。但無法解決問題。我也試着清除viewDidDisappear
-(void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:YES];
[[SDImageCache sharedImageCache]clearMemory];
[[SDImageCache sharedImageCache]clearDisk];
}
但它不是有效的方式內存和緩存。當服務器上的映像更新時,是否有任何其他方式來更新緩存?
你有什麼辦法知道圖像是否已更新? – ShahiM
嘗試使用此 ** [[SDImageCache sharedImageCache] imageCache clearMemory]; ** ** [[SDImageCache sharedImageCache] imageCache clearDisk]; ** –
@EktaMakadiya,清除緩存每次都會從服務器重新載入數據。它忽略了SDWebImage的使用。 –