我有一个自定义的TabViewController
,我希望将Self
作为Delegate
从ViewController
一传递到ViewController
二(这是模态)。问题是,当我使用tabs
在viewcontrollers
之间切换时,prepare
函数不会被触发,因为tabviewcontrollers
处理我假设的转换。
那我该怎么做呢?如何将self
从一个ViewController
传递到下一个。
实际上,在任何VC里面,你可以做的
// suppose you need to access second tab
if let targetVC = self.tabBarController?.viewControllers[1] as? SecondVC {
// do what you want
}