What is the best way to pass a variabile between 2 different view controllers ?
The only way that I acually know it’s:
app = (yourApp_comAppDelegate *) [[UIApplication sharedApplication] delegate];
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You probably should not pass data between views, rather pass data between their viewcontrollers, though they should not be modifying model objects the only thing they might report are touches or a change to their state due to user interactions, if they are Both in the same view controller then pass messages to the view controller and have it take the approrpiate action with the other view, it’s not good design to have views talk or know about each other it makes them less reusable.
Now for passing messages from the views to your view controller u should have a look at protocols , have the view define the protocol and the view controller implement it , any object can implement it really and have the view report to it…Here is a link to read about protocols
http://developer.apple.com/mac/library/documentation/cocoa/conceptual/ObjectiveC/Articles/ocProtocols.html
Hope that helps