Resise NSWindow without showing resize button

别等时光非礼了梦想. 提交于 2019-12-11 12:19:29

问题


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?


回答1:


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;
}


来源:https://stackoverflow.com/questions/32027544/resise-nswindow-without-showing-resize-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!