重新加载 ViewController [英] Reloading a ViewController

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

问题描述

我有一个视图控制器显示一些信息(不是表格视图).

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];

老实说,我认为这是让我们期待最好"的解决方案,在这种情况下.有几种方法可以更新您的 UIViews:

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天全站免登陆