I’ve an app that keep four variables in the first view controller.
The second view controller, pushed through navigation controller, should send these variables to a web form.
So I need these four vars in the second view controller.
At the moment, in the 1st view controller I set the vars in the app delegate with:
MyDelegate *delegate = (MyDelegate *) [[UIApplication sharedApplication] delegate];
delegate.var1 = var1;
delegate.var2 = var2;
[...]
And when I need them in the second view controller, I’ll get them through my delegate.
But probably, this is the wrong way.
How can I transfer my vars between the controllers? What’s the best way?
Declare properties for these variables in the second view controller and then, when you create the second view controller and before you push it to the navigation stack, assign values to those properties.