Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios FXImageView:在URL处更改的图像不会在imageView中更新_Ios_Objective C_Uiimage - Fatal编程技术网

Ios FXImageView:在URL处更改的图像不会在imageView中更新

Ios FXImageView:在URL处更改的图像不会在imageView中更新,ios,objective-c,uiimage,Ios,Objective C,Uiimage,我有一张照片。我通过传递图像的URL来加载图像,但问题是,如果服务器上的图像发生更改,它不会反映在图像视图中图像的更改中。它仍然显示旧的形象。我认为这可能是在URL上缓存图像,并在不更新图像的情况下显示 如何从服务器获取更新的映像 我的代码如下: self.userPhotoImageView.asynchronous = YES; self.userPhotoImageView.contentMode = UIViewContentModeScaleAspectFit; NSString *i

我有一张照片。我通过传递图像的URL来加载图像,但问题是,如果服务器上的图像发生更改,它不会反映在图像视图中图像的更改中。它仍然显示旧的形象。我认为这可能是在URL上缓存图像,并在不更新图像的情况下显示

如何从服务器获取更新的映像

我的代码如下:

self.userPhotoImageView.asynchronous = YES;
self.userPhotoImageView.contentMode = UIViewContentModeScaleAspectFit;
NSString *imagePath = //constant image url path to server
NSURL *imageURL = [NSURL URLWithString:imagePath];
[self.userPhotoImageView setImageWithContentsOfURL:imageURL];

那是故意的。FXImageView无限期地缓存图像。您可以在客户端通过手动从FXImageView缓存中删除图像或修改缓存键来清除它们,但FXImageView不提供任何方法来检测服务器上的图像是否已更改,因为一旦下载图像,它就不会对该URL发出任何进一步的网络请求,这就是问题所在

如果更改服务器上的图像,还应更改文件名/URL,以使其不会被缓存。如果您不能或不想这样做,则可能需要修改FXImageView,或寻找其他解决方案

如果需要使用FXImageView的特效渲染,一个选项是使用另一个库(如AFNetworking或SDWebImage)单独下载图像,然后使用setImage:方法而不是setImageWithURL:将图像插入FXImageView