• 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: NSTableView and NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView and NSView


  • Subject: Re: NSTableView and NSView
  • From: j o a r <email@hidden>
  • Date: Tue, 21 Nov 2006 19:13:30 +0100


On 21 nov 2006, at 18.31, Michael Watson wrote:

Right, that's where I found the example project. But there isn't really any documentation there that explains how this accomplishes the task.

Quick background: It would be great to have a control like NSTableView that could "serve up" views and not cells. As creating a replacement for NSTableView from scratch would be quite a task - both initially, and in maintenance - I created this proof-of-concept of how it can be done using a slim wrapper for the standard NSTableView.


Now on to a quick and simplified overview of how the SubviewTableView (SVTV) works:

In a regular table view you have this configuration:

	NSTableView -> NSTableDataSource

My hack introduces a middle man and a new protocol, like this:

	NSTableView -> SVTVController -> SVTVControllerDataSource

The NSTableDataSource protocol provides object values for rows. In much the same way, the SVTVControllerDataSource protocol provides NSView instances for rows.

When the NSTableView asks the SVTVController for an object value for a cell, it turns around to the SVTVControllerDataSource to get the appropriate NSView and returns that.

The cell is a custom subclass that doesn't draw anything. Instead, when asked to draw, it takes the view it received earlier, and inserts it as a subclass to the table view, in the position where it was asked to draw.

And that's basically it. It works pretty OK for simple things, but standard disclaimers apply... ;-)

j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________

Cocoa-dev mailing list      (email@hidden)

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: NSTableView and NSView
      • From: Scott Stevenson <email@hidden>
    • Re: NSTableView and NSView
      • From: "I. Savant" <email@hidden>
References: 
 >NSTableView and NSView (From: Michael Watson <email@hidden>)
 >Re: NSTableView and NSView (From: Brian Ganninger <email@hidden>)
 >Re: NSTableView and NSView (From: Michael Watson <email@hidden>)

  • Prev by Date: Re: Yielding an NSThread-started thread
  • Next by Date: Re: New WebView
  • Previous by thread: Re: NSTableView and NSView
  • Next by thread: Re: NSTableView and NSView
  • Index(es):
    • Date
    • Thread