My app has an option that allows the user to choose between the standard "full-size" window titlebar/toolbar and the "compact" titlebar/toolbar made available in the NSWindow
10.10 API. Specifically, I'm using the -titleVisibility
method to set either NSWindowTitleVisible
or NSWindowTitleHidden
depending on the user's preference. If the user checks the "Compact Titlebar" checkbox, NSWindowTitleHidden
is applied to the window, otherwise, the window uses the default style. When the checkbox value changes, the value is stored in the app's user defaults, and the window is updated/redrawn.
Everything works great until the application is relaunched. Each time the app starts up, the window grows by exactly how much space is saved by switching from the default window style (NSWindowTitleVisible
) to the new style (NSWindowTitleHidden
). So restarting the app 5 – 6 times will make the window flush with the menubar and the dock, depending on how big the window was when the checkbox was initially checked.
In other words, it doesn't seem like the window's frame is being updated in NSUserDefaults
when the property is set. Is there a workaround for this, or am I just overlooking something? Any advice would be muy helpful.
Thanks!
Try setting the
titleVisibility
property to the number 1 in the User Defined Runtime Attributes1 is the corresponding value for
NSWindowTitleHidden
However this would print a message to the console complaining that NSWindow is not key value coding-compliant for the key titleVisibility on OS X versions previous to 10.10