Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have used dimissViewControllerAnimated to return the view from Spring Insert Variables back to Spring Element. At the same time, my input datas should be passed from Spring Insert Variables back to Sprint Element by the function unwindSecondView in Spring Element class.

But apparently the datas are not pass, my arrays: force and stiffness still do not contain value. Can anyone advice on this?

Code From Spring Insert Variables class

class springInsertVariables : UIViewController {

var forceVar = [Float] ()
var stiffVar = [Float] ()
@IBOutlet weak var forceEntered: UITextField!
@IBOutlet weak var stiffnessEntered: UITextField!

@IBAction func submit(sender: AnyObject) {

    forceVar.append((forceEntered.text as NSString).floatValue)
    stiffVar.append((stiffnessEntered.text as NSString).floatValue)

    println(forceVar) //This doesn't print on my output
    println(stiffVar) //This doesn't print on my output
    dismissViewControllerAnimated(true, completion: nil)

   }
}

Code From Spring Element Class

 @IBAction func unwindSecondView(segue: UIStoryboardSegue) {

     if let svcspringinsertvariables = segue.sourceViewController as? springInsertVariables {
        self.force = svcspringinsertvariables.forceVar
        self.stiffness = svcspringinsertvariables.stiffVar
        println(force)
        println(stiffness)
    }
}

Storyboard of my 2 views

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
172 views
Welcome To Ask or Share your Answers For Others

1 Answer

dismissViewControllerAnimated does not actually use the unwind segue. An unwind segue is like any other segue and must be performed using performSegueWithIdentifier.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...