跨视图通信 [英] Cross View Communication

查看:135
本文介绍了跨视图通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的主窗口有一个UIWebView。我可以通过我的第二个视图控制器来控制吗?

I have a UIWebView on my main window. Can I control that via my second view controller? If so could you give me an example?

推荐答案

是的,你可以。 how是一个基本的Cocoa /应用程序架构主题,您可以从Apple或任何其他网站的介绍文档中学习。

Yes you can. The "how" is a basic Cocoa / application architecture subject you can learn from the introductory documentation from Apple or any number of other web sites.

以从第二控制器引用网络视图的控制器(或网络视图本身)。这可以是第二控制器中的出口或常规实例变量。这是一个调用 [firstController makeTheWebViewDoSomething];

The gist is that you need to have a reference to the web view's controller (or the web view itself) from the second controller. This could be an outlet or a regular instance variable in the second controller. Then it's a matter of calling [firstController makeTheWebViewDoSomething];.

参见与对象通讯

这篇关于跨视图通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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