我有一个ViewController A和一个带有4个子ViewController B,C,D,E的标签栏控制器。
我想从VcA传递字符串数据-> VcB。因此,如何传递数据,请帮帮我。
在View Controller A中]
@IBAction func nextButonTapped(_ sender: Any) { if let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Tabbar") as? ViewControllerB{ vc.data = "Hello" } }
在标签栏的viewcontrollerB中,我刚刚打印了var“ data”
我有一个ViewcontrollerA和一个带有4个子ViewController B,C,D,E的标签栏控制器。我想从VcA-> VcB传递字符串数据。因此,如何传递数据,请帮帮我。在视图中...
如果您在与VCB/TabBar
相同的NavigationController
上推动VCA
,则可以从VCA
内部的navigationController
轻松访问VCB
,如下所示]
如果您正在使用NavigationController传递数据viewController-> Tabcontroller。请尝试在按钮/ tableviewCell / collectionViewCell上点击代码。单击/按下