A set of example programs and source code to accompany a series of MacTech articles that describe techniques for the NSTableView in Cocoa applications ....

Download the Application for Part 3

Download the Source Code for Part 3

(TableTester 3 contains all functionality of parts 1 and 2, no need to get them particularly, but here they are:)
Download the Application for Part 1
Download the Source Code for Part 1
Download the Application for Part 2
Download the Source Code for Part 2

Errata / Notes

Striping Problems

I think there's a bug in Interface Builder where sometimes the column you create in Interface Builder has the "drawsBackground" set on, which interferes with striping. You could try to create new columns in IB until you find the ones that are correct, or you could correct it in code in your awakeFromNib method, something like this:

	// FIX the data cell that, for some reason, has "drawsBackground" set on.
	NSTableColumn *titleColumn = [oReadTable tableColumnWithIdentifier:@"title"];
	[[titleColumn dataCell] setDrawsBackground:NO];
	titleColumn = [oSearchTable tableColumnWithIdentifier:@"title"];
	[[titleColumn dataCell] setDrawsBackground:NO];

The vertical grid lines are not updated correctly when you resize the column widths. A fix to this, courtesy of Eric Roccasecca of CE Software, is to add this to the drawGridInClipRect: method:

[[self superview] setNeedsDisplayInRect:[[self superview] bounds]];

Another bug is when you resize the window after having decreased the size of the name column, the stripped background is not drawn at some locations. This can be fixed by settings the resizing springs of the NSTableView subclass widget.


Feedback? Drop me a line.... .... dan at this domain with the subject line or message containing "Cocoa" to get past the spam-filters!