重新加载视图控制器上的数据关闭 [英] Reload Data On View Controller Dismiss

查看:151
本文介绍了重新加载视图控制器上的数据关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表视图,它填充了网络上的数据。要将信息添加到此列表中,我有一个以模态显示的配置屏幕。当成功添加数据时,配置屏幕被关闭,我希望表视图中的数据自动从网络载入,以反映新添加的数据。



什么是在关闭配置视图后,最好的方法来重新加载该远程数据。我尝试了一些方法,包括使用委托来发送信息,并且仅在视图中加载数据将会出现,但希望知道最安全和最有效的方法。



提前感谢!

解决方案

你想加载它在视图加载,它大大简化了事情 - 加上它只有在用户想要的时候才会加载数据,从而在3g上保存他或她的潜在可能的数据。如果在3g。

当数据加载时,如果视图已经出现,那么您可以在视图的顶部显示加载视图,禁用用户交互,直到完成加载,然后将其从其超级视图中删除,并在将数据呈现给表视图时再次启用用户交互。这通常是我以前做过的,以及我将来如何看待这件事。


I have a table view, which populates data from the web. To add information to this list I have a configuration screen presented modally. When data is added successfully the configuration screen is dismissed, I would like the data in the table view to automatically reload from the web to reflect the newly added data.

What is the best way to go about reloading this remote data after the configuration view is dismissed. I have tried a number of approaches including using a delegate to send information back and loading the data only on view will appear but would like to know the safest and most efficient way of doing this.

Thanks in advance!

解决方案

You want to load it on view loading, it greatly simplifies things—Plus, it only loads data when your user wants it, thus saving him or her potentially some data on their conceivably limited data plan if on 3g.

While the data is loading, if the view has appeared, then you can display a "loading" view on top of your view, disable user interaction until it's done loading, then remove it from its superview and enable user interaction again, while presenting the data to your table view. This is generally how I've done it in the past, and how I'd look at doing it in the future.

这篇关于重新加载视图控制器上的数据关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆