[英]View based delegation in storyboards and UITabbarController
我知道有人问过这个问题,但是我不知道该如何使用我的应用程序进行这项工作-我确定我做错了。
我在UITabBarViewContoller
嵌入了两个视图控制器, FirstViewController
和SecondViewController
。 SecondViewController
就是一些用于管理应用程序连接到的主机名和端口的UITextFields
。
FirstViewController包含大多数代码(我知道它不是非常面向MVC的)。 我试图实现从SecondViewController
到FirstViewController
( 在View Controllers之间传递数据 ),但似乎未调用我的委托方法。 由于这是基于情节SecondViewController
,因此我没有创建SecondViewController
的实例,也不确定如何设置Delegate。 有没有一种方法可以访问SecondViewController
的实例,以便我可以设置Delegate?
哩程谢谢!
我的解决方案(迅速)
let secondView = self.tabBarController.viewControllers[1] as SecondViewController
secondView.delegate = self
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.