Reputation: 17677
I've extended my window so that it has a button content border. The problem is that my NSSplitView covers the border. My thoughts were that I could make the split view transparent (but the controls on top of it opaque).
The following image shows what I am looking for, but with the missing splitter:
See how the bottom of the window has the button on it. This is the effect I am trying to achieve, but without any luck. The code that I am attempting to use is:
CALayer *transparentViewLayer = [CALayer layer];
[viewLayer setBackgroundColor:CGColorCreateGenericRGB(
256.0,
256.0,
256.0,
0)]; //RGB plus Alpha Channel
[splitView setWantsLayer:YES]; // view's backing store is using a Core Animation Layer
[splitView setLayer: transparentViewLayer];
If I do NOT set the transparentViewLayer, then I end up with the following:
Which shows the spitter, but hides the windows bottom bar. I have also tried subclassing NSSplitView
and adding the following:
- (void) drawRect: (NSRect) dirtyRect
{
[[NSColor colorWithSRGBRed: 0.0 green: 255.0 blue: 0.0 alpha: 155.0] setFill];
NSRectFill(dirtyRect);
} // End of drawRect
Which left me with a green splitter and no alpha for the windows bottom bar. Any ideas on how I can achieve the effect I am looking for? (I want the bottom bar with my buttons and the splitter visible).
Upvotes: 0
Views: 890
Reputation: 61228
In your subclass, don't override -[NSSplitView drawRect:]
. Instead, override -drawDividerInRect:
and draw your divider ONLY in that rect. Always consult the documentation first when you want to "bend" a class to your will.
Upvotes: 0