[英]How do I send self as a delegate from one viewController in a tabViewController to another viewController
I have a custom tabViewController
and I would like to pass self
as a delegate
from viewController
one to viewController
two (which is modal).我有一个自定义
tabViewController
,我想将self
作为delegate
从viewController
一传递到viewController
二(这是模态的)。 The problem is that when I go between viewControllers
using the tabs
the prepare
function isn't triggered as the tabViewController
handle the transitions I suppose.问题是,当我在 viewControllers 之间使用
tabs
viewControllers
时, prepare
function 不会被触发,因为tabViewController
处理了我想的转换。
So how do I make this happen?那么我该如何实现呢? How do I pass
self
from one viewController
to the next.如何将
self
从一个viewController
传递到下一个。
Actually inside any VC that's inside the tab you could do实际上,在选项卡内的任何 VC 中,您都可以执行
// suppose you need to access second tab
if let targetVC = self.tabBarController?.viewControllers[1] as? SecondVC {
// do what you want
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.