• 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: (no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (no subject)


  • Subject: Re: (no subject)
  • From: Jeremy French <email@hidden>
  • Date: Mon, 31 Jan 2005 15:50:57 -0500

Yes, by implementing these two methods from NSTableDataSource protocol in your data source class, to display data in the table:

1) numberOfRowsInTableView:
2) tableView:objectValueForTableColumn:row:

When the table "wants" to display itself, it will call these two methods to display each cell in the table. When the method "tableView:objectValueForTableColumn:row:" is called, you can identify the cell to display by getting the column identifier and row number. You then return the value to be displayed in the cell.

You let the table instance in Interface Builder know about your data source class by instantiating the data source class in Interface Builder. Then draw a connection from the table to the data source, and select "dataSource" as an outlet.

Chapter 9 of "Learning Cocoa with Objective-C (second edition)" has a table example.

More info:

<http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/ObjC_classic/Protocols/NSTableDataSource.html#// apple_ref/occ/cat/NSTableDataSource>

On Jan 30, 2005, at 12:07 PM, Falko A. wrote:

My data source has to know about the index of a column to return it's data.
Is there any way to query a column for its index/position in the tableView?

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >(no subject) (From: "Falko A." <email@hidden>)

  • Prev by Date: Re: Bindings & IBOutlets
  • Next by Date: Re: I love Cocoa, but...
  • Previous by thread: (no subject)
  • Next by thread: Popup buttons, icons, and bindings
  • Index(es):
    • Date
    • Thread