Reputation: 1411
Im new to iOS development, Im trying to follow the course in Udacity.
But having trouble in performing the segue.
the prepareForSegue
never got called in my second viewcontroller.
I have two viewcontroller, one is ViewController, the other is PlaySoundViewController.
and I have link those from story board to the real class in swift.
and I have drag from the first view controller to second one to generate a segue and named it as "gonext".
and I called performSegueWithIdentifier("gonext", sender:aduio);
and in the second view controller I implement the prepareForSegue
, however, it never got called.... but it managed to go to the next view.
Upvotes: 1
Views: 416
Reputation: 1192
To go to the next view controller you have to perform the method
Self.performSegueWithIdentifier("gonext", sender:aduio);
The one thing that you are getting wrong is that you have to run the prepareForSegue method in the first view controller and not the second view controller to send the data.
So instead of running the prepareForSegue method in the second view controller just run it in the first.
Upvotes: 3