【发布时间】:2018-06-11 20:15:20
【问题描述】:
我正在尝试通过更改tabBarController 的selectedIndex 从ViewController1 变为ViewController2。
在 ViewController1 中:
func action() {
_ = self.tabBarController?.selectedIndex = 4
}
在 ViewController2 中:
class ViewController2: UIViewController {
var isOnInfo = true
}
我的问题很简单。我想在action() 函数中更改isOnInfo 的值。
有可能吗?
另一种方法是创建一个全局变量,但如果我能避免这样做会更好。
感谢您的回答。
【问题讨论】:
标签: ios swift swift3 delegates