简体   繁体   English

来自iOS中服务器的图像库

[英]image gallery from server in ios

I'm working on retreiving images from server and display it in ios.I select the image that I need to see on full screen it comes. 我正在努力从服务器检索图像并将其显示在ios中。我选择了需要在全屏上查看的图像。 But the problem is, once I go back, it reloads the whole images again from server. 但是问题是,一旦我返回,它将再次从服务器重新加载整个图像。 Are there any solution so as to save it in cache file for a while. 有什么解决方案可以将其保存在缓存文件中一段时间​​。 I searched the whole internet for this, but didn't get a proper solution. 我在整个互联网上搜索了此内容,但没有找到合适的解决方案。 Can any one please specify best tutorial for that. 任何人都可以为此指定最佳教程吗? I'm newbie to ios 我是ios的新手

If each time you go back it reloads all the images agin from the server is probably because you may either create a new view or because you are calling to load the images from the method viewWillAppear instead of in the viewDidLoad 如果每次您返回时都从服务器重新加载所有图像,可能是因为您可能创建了一个新视图,或者是因为您正在调用从方法viewWillAppear而不是viewDidLoad中加载图像

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Load the images here...

}

Instead of in here: 而不是在这里:

- (void)viewWillAppear:(BOOL)animated
{
   [super viewWillAppear:animated];
}

If this doesn't not help, please provide us with some code. 如果这样做没有帮助,请向我们提供一些代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM