[英]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.