3

for give me if this has been asked before, but I can't seem to find any question answer that would give me the desired behaviour that I am looking to achieve.

I have mostly the behaviour that I am looking to achieve, font style and colour, header height, etc. But, I can't seem to get the header to be transparent. I have been trying to do this by subclassing NSTableHeaderCell and override - (void)drawWithFrame:(NSRect)cellFrame highlighted:(BOOL)isHighlighted inView:(NSView *)view;

[[NSColor colorWithDeviceWhite:1.0 alpha:0.75] set];
NSRectFillUsingOperation(fillRect, NSCompositeSourceOver);

The look I am trying to achieve is in this screenshot. This being my first question ever, I had to host the image, because I don't have enough points to include an image in my question.

If someone could explain to me a little more how to achieve this style of header, or point me to the right documentation that would be grateful.

2 Answers2

0

That is not a header view but rather a floating group row. Note position of the scrollbar: it's next to the "header" and not below.

Look for TableViewPlayground sample project, specifically "Complex Table View" example. You can create a single floating group row in your table and make it look and act like a header view (i.e. show your own sort indicator and accept clicks to toggle sorting).

pointum
  • 2,987
  • 24
  • 31
0

Use the following works:

Objective-C:

[[NSColor colorWithDeviceWhite:1.0 alpha:0.75] set];
NSRectFill(fillRect);

Or in Swift:

NSColor(deviceWhite: 1.0, alpha: 0.65).setFill()
NSRectFill(fillRect)
Harry Ng
  • 1,070
  • 8
  • 20