In an app I was working on, I also wanted the whole column to be highlighted.  
Here are comments from the code indicating how I did it.  Some of these ideas 
might help:

 We want the selected column to be highlighted, for purposes of deleting 
columns.  NSTableView does not provide this.  When you select a column in a 
stock NSTableView, only the column header changes in appearance.  To make the 
whole column turn blue, as when user selects a row, we do the following:

 1. In the xib, set the intercell spacing of the table to 0.

 2. In in the Auto Layout constraints, leave margins of several points around 
the subviews, so that there will some space for the dark blue to show through.

 3. In -[MyTableColumnView drawRect:], detect if the view is in a selected 
column and, if so, draw the blue background.

 4  Receive notifications when the selection is changed, because it may be a 
column selection or deselection, in -[MyTableViewDelegate 
tableViewSelectionDidChange:], and setNeedsDisplay to the whole table, so that 
-[MyTableColumnView drawRect:] will run for each cell.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to