How to remove NSTableView border and change cell selection color in the same way as Finder?

I am making a Cocoa application for Yosemite.

I added an NSTableView-based one in the interface builder, but 2 pixels wide and thicker than Yosemite Finder. And the cell selection color is blue, and the Yosemite Finder is gray.

enter image description here

enter image description here

And this is what the view of the Yosemite Finder table looks like.

enter image description here

I checked the settings in Interface Builder. Super scroll view for setting the NSTableView frame (0,0,149,257): enter image description here

While the parameter of the viewing viewing frame (1, 1, 147, 255) cannot be changed.

enter image description here

And how to make the same NSTableView as Yosemite Finder?

Thank you, ton!

+4
source share
3 answers

Finder - NSOutlineView:

enter image description here

:

enter image description here

, NSOutlineView Interface Builder:

enter image description here

+8

- , " ". ,

- (BOOL)becomeFirstResponder {
    return NO;
}

Edit: becomeFirstResponder , . , becomeFirstResponder.

NSTableRowView () setEmphasized::

- (void)setEmphasized:(BOOL)emphasized {
    // This avoids a blue background when selected in a source list that has first responder status.
}

NSTableRowView,

- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row

NSTableViewDelegate.

+2

NSTableView...

NSTableView, . , . , , . - , .

  • NSTableView CustomBox. Box BorderType ""
  • (Left, Top, Right Bottom) NSTableView Box. -2. NSTableView
  • Now in the Storyboard select "clipView (NSClipView)" NSTableView. clipView is an NSTableView supervisor
  • Go to the Dimension inspector and uncheck the "Automatically configure" checkbox in the "Insert Content" section
  • Set values Left=2, Top=2, Bottom=-2andRight=-2

Here it is.

0
source

All Articles