• 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: Problems with DataSource Class & Controller Class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with DataSource Class & Controller Class


  • Subject: Re: Problems with DataSource Class & Controller Class
  • From: Dustin Voss <email@hidden>
  • Date: Fri, 13 Feb 2004 16:25:36 -0800

On 12 Feb, 2004, at 4:42 PM, Roberto Sobachi wrote:

I've got some problem passing from an NSTableView DataSource Class to
the Controller Class, because it doesn't see an NSArray i've declared
into controller Class.

I've not init function in Controller class. Is it the problem?
With init function it see the NSArray object, but it initialize it
every time I call functions under Controller class.

That doesn't sound right.

In NSTableView DataSource Class I've got the function to accept DROP
files - (BOOL)tableView:(NSTableView*)tv acceptDrop:(id
<NSDraggingInfo>)info row:(int)row
dropOperation:(NSTableViewDropOperation)op that works fine, but I need
to call a function under Controller class to update an NSArray Object.

How can I do it?

As I understand it, you have a Controller and a table view and a Data Source. The Controller has an array, and the table view should display the array via the Data Source. You don't know how to make the Data Source call a method in the Controller to update the array.

Your problem is how to make the Data Source aware of the Controller. You probably have the Data Source in a NIB file controlled by the Controller. In this case, you can add an IBOutlet to the Data Source to hold the Controller, and connect the Controller to the IBOutlet. Alternatively, your Controller creates the Data Source programatically. In this case, it is a simple matter to create a method like "setController:" in the Data Source, which the Controller will then call after creating the Data Source. I do not believe that setController: should retain the Controller, though I am not sure about this.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Problems with DataSource Class & Controller Class (From: Roberto Sobachi <email@hidden>)

  • Prev by Date: Re: static objects "autoreleased with no pool in place - just leaking"
  • Next by Date: Re: Problems with 2 classes HELP
  • Previous by thread: Problems with DataSource Class & Controller Class
  • Next by thread: Undo in NSTextView broken when runModalForWindow: ?
  • Index(es):
    • Date
    • Thread