• 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: Populating NSTableView from data source
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Populating NSTableView from data source


  • Subject: Re: Populating NSTableView from data source
  • From: Bill Cheeseman <email@hidden>
  • Date: Sat, 28 Feb 2004 17:24:38 -0500

on 2004-02-28 4:15 PM, mmalcolm crawford at email@hidden wrote:

> On Feb 28, 2004, at 1:00 PM, Matt Jaffa wrote:
>> I was wondering how I let my NSTableView from where to get its data
>> after
>> you do:
>> NSTableView *table;
>> [table reloadData];
>> I was looking at an example in a cocoa book, but it doesn't say how to
>> make
>> the TableView load from a certain data source.
>>
> Umm, from its dataSource:
>
> <http://developer.apple.com/documentation/Cocoa/Reference/
> ApplicationKit/ObjC_classic/Classes/NSTableView.html>
> " dataSource
> Returns the object providing the data that the NSTableView displays."

Strictly speaking, the datasource is the object where you have implemented
the datasource protocol methods. The data itself can be located anywhere --
for example, in a separate model class -- as long as the datasource protocol
methods know how to find it.

The -reloadData method calls the -tableView:objectValueForTableColumn:row:
protocol method, to oversimplify just a little bit. That protocol method
could return its objectValue from an array declared in a separate class. It
is much more common, however, to declare both the protocol methods and the
data itself in a single class.

Either way, you can conveniently use Interface Builder to connect the table
view's "datasource" outlet to the class that contains the datasource
protocol methods (NOT to the class that contains the data variables, unless
the two classes happen to be one and the same).

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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: 
 >Re: Populating NSTableView from data source (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Populating NSTableView from data source
  • Next by Date: Multiple targets in a project
  • Previous by thread: Re: Populating NSTableView from data source
  • Next by thread: Multiple targets in a project
  • Index(es):
    • Date
    • Thread