1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Send data to another view

Discussion in 'iPhone/iPad Programming' started by Ploetzeneder, Oct 15, 2009.

  1. macrumors newbie

    #1
    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
     
  2. Moderator

    robbieduncan

    Staff Member

    #2
    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.
     
  3. macrumors newbie

    #3
    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?
     
  4. Moderator

    robbieduncan

    Staff Member

    #4
    Go and read about the MVC architecture. Then think about what you are doing.
     
  5. macrumors newbie

    #5
    i know that this has nothing to do with the mvc, but it is just a small application for a demo.

    thanks anyway
     
  6. Moderator

    robbieduncan

    Staff Member

    #6
    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.
     
  7. macrumors newbie

    #7
    thx i got it
     

Share This Page