I have 12 ViewControllers. My code gives a random segue to one of these ViewControllers (1-12)
let segues = ["View1", "View2", "View3", "View4", "View5", "View6", "View7", "View8", "View9", "View10", "View11", "View12"]
let index = Int(arc4random_uniform(UInt32(segues.count)))
let segueName = segues[index]
self.performSegueWithIdentifier(segueName, sender: self)
.
Now, I want to change a variable in the random ViewController that has been chosen (var firstSegue = false
) but I can't figure out how?
.
Could someone change this into something that will work?
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let destinationVC = segue.destinationViewController as UIViewController
destinationVC.firstSegue = true
}
Aucun commentaire:
Enregistrer un commentaire