Rob Sanders
Rob Sanders

Reputation: 5367

Resise NSWindow without showing resize button

I would like to have an NSWindow that is resizable but without showing the little green resize button in the top left corner. Is this possible?

Upvotes: 1

Views: 325

Answers (1)

Marek H
Marek H

Reputation: 5576

Create custom subclass of NSWindow and override "standardWindowButton: forStyleMask:" class method

@interface CustomWindow : NSWindow
@end

@implementation CustomWindow

+ (NSButton *)standardWindowButton:(NSWindowButton)b forStyleMask:(NSUInteger)styleMask
{
  NSButton *button = [super standardWindowButton:b forStyleMask:styleMask];
  if (b == NSWindowZoomButton) {
    button.hidden = YES;
  }
  return button;
}

Upvotes: 3

Related Questions