• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: passing an object between views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing an object between views


  • Subject: Re: passing an object between views
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 20 Aug 2008 14:11:15 -0400

  If I understand your question, it appears the concept you're missing
is the Model-View-Controller (MVC) design pattern around which Cocoa
is heavily designed. The controller should be where your XML (which
belongs to the model layer) is generated. The controller would
conceptually have an outlet to both views (or would have an outlet to
another controller, which in turn is in charge of updating one or more
views.

MVC Pattern (in Cocoa)
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html

  If you have a master/detail interface, as Joar suggested, I'd argue
(and I have recently) that both views should be handled by the same
controller for convenience and clarity. When your controller
generates, changes, or removes the model (your array), it should
update the views it's in charge of accordingly.

  Hopefully that's what you're after. :-)

--
I.S.

  (Proudly top-posted from my iPhone. Deal with it, Mr. or Mrs. OCD! :-))


On Tue, Aug 19, 2008 at 8:31 PM, John Greene <email@hidden> wrote:
> Hello,
>
> Hopefully this is a generic enough question that it applies to general
> Cocoa development:  How do I pass an object between views?  That is: I
> have an array of objects that I've built using NSXMLParser, and that
> populates a table, and clicking on a cell changes my view to another
> table with a separate controller.  I had originally thought that I could
> just write a method, setTableData in the secondary controller, that
> takes an object as an argument, and then use that object to build the
> secondary table.  This is apparently forbidden by the language, so
> what's the proper approach?  I could make the array available somehow to
> the new controller, since I can pass the integer index, but I'm not sure
> how!
>
> Thanks,
>
> John
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >passing an object between views (From: John Greene <email@hidden>)

  • Prev by Date: [Q] Using SFAuthorizationView in a Preference Pane project
  • Next by Date: Re: Core Data Versioning - more than two versions, how to map upgrades?
  • Previous by thread: Re: passing an object between views
  • Next by thread: This document's file has been changed by another application?
  • Index(es):
    • Date
    • Thread