views:

169

answers:

2

I like to create a Cocoa window without any chrome whatsoever. The only thing the user should see is what I draw.

I've discovered I can create a custom NSView but does this have to be in an NSWindow to display? If not, how can I display it without putting it in an NSWindow? If it does have to be in an NSWindow, how do I stop the window from drawing a title bar and other chrome?

+1  A: 

I've discovered I can create a custom NSView but does this have to be in an NSWindow to display?

Yes.

If it does have to be in an NSWindow, how do I stop the window from drawing a title bar and other chrome?

Use NSBorderlessWindowMask when you create your window. (Assuming you aren't using a custom subclass of NSWindow, this means not creating the window instance in a nib. If you want to lay out your view hierarchy in a nib, do that in a top-level custom view, then load the nib and set that view as the window's content view.)

Peter Hosey
You can still create the window in a nib - just pass the borderless flag to super in the window's initializer and set the window to your subclass in the nib.
Jason Coco
That's assuming you subclass NSWindow for it.
Peter Hosey
Edited accordingly. Thanks.
Peter Hosey