• 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
Sharing a model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sharing a model


  • Subject: Sharing a model
  • From: Scott Steinman <email@hidden>
  • Date: Sun, 13 Feb 2011 02:57:28 -0600

Please forgive me since I'm a Cocoa newbie (having programmed in about a dozen programming languages on many computer architectures -- this hints at my age!), but I can't find an answer to what I think should be a simple question via the Apple documentation, multiple Cocoa books, or web search engines.

I'm working on an application that takes medical test data and outputs diagnostic data. My application's window contains several controls and labels to enter numeric data and display the results of the calculations.  It also contains a custom NSView that will present a graphical representation of the data.  At present, the model and the window are interconnected by one controller. The model object is instantiated in the awakeFromNib: method of the controller.  However, the controller class will get huge when the graphics code is added.

I'd like to split up the controller class into more manageable parts.  I'm hoping to have one controller for the graphics NSView alone and another for everything else in the window. Both controllers would need access to the same model. What is the best way to accomplish this?

1. Where should I instantiate and later dealloc the model object?

2. How do I get both controllers to reference this single model without creating coupling between the controllers?

3. When should the reference to the model be set up in each controller?

Thanks in advance for your help.

Scott Steinman
_______________________________________________

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

  • Follow-Ups:
    • Re: Sharing a model
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Parsing PDF
  • Next by Date: IKImageBrowserView moveItemsAtIndexes and imageRepresentationType
  • Previous by thread: NSScrollView subclass not working with inertia
  • Next by thread: Re: Sharing a model
  • Index(es):
    • Date
    • Thread