I've been trying to build a specific look for my menubar app.
I've been using a NSWindow
with a NSBorderlessWindowMask
style mask and setting [window setOpaque:NO]
and [window setBackgroundColor:[NSColor clearColor]]
. That gives me a blank canvas which works great for the title bar.
Now I'm having problems with the view-based NSTableView
I'm using for the listing. How can I clip the NSTableCellView
s to the window's rounded corners?
I started out just having a custom view wrapping the NSTableView
, drawing the background with rounded corners. Using [view addClip:path]
doesn't clip child views though.
I've also tried using a [view setWantsLayer:YES]
with a mask. That worked great, but the table view cells would sporadically glitch out. It seems that having a NSScrollView
be a child of a layer is a known problem:
My current view structure looks something like:
NSWindow
- MyTitleBarView
- MyBackgroundView
- NSScrollView
- NSTableView