Trying to do something I\'ve seen documented in a lot of places, but can\'t seem to manage. I\'m trying to pass data from one view to another during a segue.
Here\'s
I think I had absolutely the same problem, so hope my solution will help you too. It should answer first part of your question, or at least will help some one else.
First of all you can't assign passed values to properties with viewDidLoad
method in the SecondViewController. Doing so, gives nil, as viewDidLoad is implemented before Segue.
And I wouldn't recommend to use viewDidAppear
, as as the values will be changed after the view is loaded, witch makes the change process be visually visible.
So, the best option is to assign the values directly to the IBOutlet's
.
If you want to pass an array of strings, you can assign one array value witch you want to load first, and also pass all NSArray
. This will allow your view to be loaded with the value already, and also you will have other values to work with.
You could also call method and pass data.