Swift在标签栏之间传递变量

时间:2014-12-17 01:02:13

标签: ios swift uitabbarcontroller

我想将数据从一个标签栏发送到第二个标签栏。我该怎么做呢? Prepareforsegue?这是我尝试过的:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?){

    var tabBarController = segue.destinationViewController as UITabBarController

    var playerStats = tabBarController.viewControllers?[1] as TabBarTwoViewController

    playerStats.test = 12

}

0 个答案:

没有答案