-
Notifications
You must be signed in to change notification settings - Fork 0
NSWindow
Most Mac windows have rounded corners these days (unless they suck, like Script Editor). Unfortunately, this isn't entirely automatic. To get this, you need to make sure the contentView!.wantsLayer = true
when your window is loaded. If you're using IB and have access to the root view of your window (which doesn't seem to be possible with storyboards, sadly), open the "View Effects inspector", and click the checkbox next to it in the "Core Animation Layer" section (yes, it is horribly named).
Want to make a window with a tiny title bar, like the standard font or color ones? That's called a "utility window". Make an NSWindow (or NSWindowController) in Interface Builder, and in the Identity Inspector, set a custom class of NSPanel. Then on the Attributes Inspector, it will have a "Style" popup that lets you choose Regular, Utility (small), or HUD (small and dark). (In code, I think it's the styleMask
attribute, but I haven't tried it, and the documentation for those constants is not very good.)
- TODO: there are visual indexes of this which are pretty useful
If you click the "Title Bar" checkbox in Interface Builder, it won't let you re-check it, even if you restart Xcode. Easy fix: in the windowStyleMask
section, add titled="YES"
.
See also: NSPanel (subclass), NSWindowController