重新加载ViewController [英] Reloading a ViewController

查看:122
本文介绍了重新加载ViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个View控制器显示一些信息(而不是表视图)。

I have a View controller displaying some information (not table views).

我有一个更新调用我的数据库的远程服务器。我希望在更新调用完成后完全重新加载我的ViewController。

I have an update call to a remote server which fills my data base. I would like to completely reload my ViewController after the update call is done.

我该怎么办?

推荐答案

你真的不需要这样做:

[self.view setNeedsDisplay];

老实说,我认为这是让我们希望找到最好的解决方案,就是这个情况下即可。有几种方法可以更新 UIView

Honestly, I think it's "let's hope for the best" type of solution, in this case. There are several approaches to update your UIViews:


  1. KVO

  2. 通知

  3. 代表团

每个人都有利弊。 根据您要更新的内容以及您的业务层(服务器连接)与 UIViewController 之间的连接类型,我可以推荐一个满足您的需求。

Each one has is pros and cons. Depending of what you are updating and what kind of "connection" you have between your business layer (the server connectivity) and the UIViewController, I can recommend one that would suit your needs.

这篇关于重新加载ViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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