Send data to another view

Discussion in 'iOS Programming' started by Ploetzeneder, Oct 15, 2009.

  1. macrumors newbie

    Joined:
    Oct 15, 2009
    #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 emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #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. thread starter macrumors newbie

    Joined:
    Oct 15, 2009
    #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 emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Go and read about the MVC architecture. Then think about what you are doing.
     
  5. thread starter macrumors newbie

    Joined:
    Oct 15, 2009
    #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 emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #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. thread starter macrumors newbie

    Joined:
    Oct 15, 2009

Share This Page