Search code examples
cocoanswindownspanel

Changing the titlebar height in an NSPanel


I'm trying to change the titlebar height of an NSPanel. I tried the following but it didn't work as expected:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
  NSRect f = [[[window contentView] superview] frame];
  f.size.height += 10;
  [[window contentView] superview].frame = f;
}

Solution

  • You can't change the height of a window's title bar. It's fixed by the framework. If you want a window with a custom appearance you'll need to create a window using the NSBorderlessWindowMask style mask and then draw your own title bar and widgets.