【问题标题】:View based delegation in storyboards and UITabbarController故事板和 UITabbarController 中基于视图的委托
【发布时间】:2014-06-23 16:59:15
【问题描述】:

我知道有人问过这个问题,但我不知道如何在我的应用中使用它——我确定我做错了。

我在UITabBarViewContollerFirstViewControllerSecondViewController 中嵌入了两个视图控制器。 SecondViewController 只不过是几个UITextFields,用于管理应用程序连接的主机名和端口。

FirstViewController 包含大部分代码(我知道这不是非常面向 MVC)。我正在尝试实现从SecondViewControllerFirstViewControllerPassing Data between View Controllers)的委托,但似乎我的委托方法没有被调用。由于这是基于故事板的,我没有创建SecondViewController 的实例,我不确定如何设置委托。有没有办法访问SecondViewController 的实例以便我可以设置委托?

【问题讨论】:

标签: ios storyboard uitabbarcontroller


【解决方案1】:

里程谢谢!

我的解决方案(迅速)

    let secondView = self.tabBarController.viewControllers[1] as SecondViewController
    secondView.delegate = self

【讨论】:

    猜你喜欢
    • 2012-01-29
    • 1970-01-01
    • 2015-01-14
    • 1970-01-01
    • 1970-01-01
    • 2012-02-17
    • 1970-01-01
    • 1970-01-01
    • 2012-06-18
    相关资源
    最近更新 更多