PDA

View Full Version : Send data to another view




Ploetzeneder
Oct 15, 2009, 02:13 PM
Hello,
i have got some views, and in one view i have got a value. This value I want to send to the next view. How do i do that ?
Is there a kind of constructor ?

Best regards,
Andreas



robbieduncan
Oct 15, 2009, 02:23 PM
You are thinking about it the wrong way: views don't store data. You save the data into your model via your controller layer then use the controller layer to retrieve it and tell the next view to display it as appropriate. How you do this is entirely dependant on how you have implemented your model layer and controllers.

Ploetzeneder
Oct 15, 2009, 02:34 PM
oops ok i wanted to send from one XIB to another XIB.
this are 2 classes so when i start the new class, i want to add more arguments...shall i add the code?

robbieduncan
Oct 15, 2009, 02:38 PM
Go and read about the MVC architecture. Then think about what you are doing.

Ploetzeneder
Oct 15, 2009, 02:45 PM
i know that this has nothing to do with the mvc, but it is just a small application for a demo.

thanks anyway

robbieduncan
Oct 15, 2009, 02:46 PM
i know that this has nothing to do with the mvc, but it is just a small application for a demo.

thanks anyway

Well then just add a property to your application delegate, save the value there (using that as your model) and have the second view controller read that to set the value in the user interface when it detects the view is shown.

Ploetzeneder
Oct 16, 2009, 01:56 AM
thx i got it