This is a simple question:
I have 2 different view controllers, and each one has its own data stored in its .m file.
I want to take a value, for instance, an integer value (int i=3;) that is declared in ViewController1 and pass it to ViewController2, so I will be able to use that value in the second view controller.
Can anyone please tell me how to do it?
2014 Edit – in case somebody happens upon this, don’t listen to me. The “better way” really is the best way.
Good Way – Create your own initWithI method on ViewController2
Better Way – Create ViewController2 as usual, and then set the value as a property.
Best Way – This is a code smell, you are tightly coupling the data with a ViewController. Use CoreData or NSUserDefaults instead.