Re: Does NSOutlineView's highlightedTableColumn work?
Re: Does NSOutlineView's highlightedTableColumn work?
- Subject: Re: Does NSOutlineView's highlightedTableColumn work?
- From: Jerry Krinock <email@hidden>
- Date: Tue, 05 Apr 2016 09:14:03 -0700
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 (email@hidden)
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:
This email sent to email@hidden