在视图控制器之间进行通信 [英] Communicating between view Controllers

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

问题描述

我的一个视图控制器具有多个UISwitch,并且我希望另一个视图控制器能够访问If/and语句的UISwitch的值.如何在Objective-c中执行此操作?

one of my view controllers has several UISwitches, and I want another view Controller to be able to access the values of the UISwitches for If/and statements. How do I do this in Objective-c?

推荐答案

您可能不想这样做.如果您希望第二个ViewController基于第一个ViewController的开关而具有不同的行为,则应仅将这些开关绑定到User Defaults,您可以在应用程序中的任何位置读取它.

You probably don't want to do that. If you want a second ViewController to have different behavior based on switches thrown in the first, you should just bind the switches to User Defaults, which you can read anywhere in your app.

http://icodeblog. com/2008/10/03/iphone-programming-tutorial-Saveretrieving-data-using-nsuserdefaults/

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

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