【问题标题】:Resise NSWindow without showing resize button调整 NSWindow 大小而不显示调整大小按钮
【发布时间】:2015-08-15 17:49:01
【问题描述】:

我想要一个可调整大小但不显示左上角绿色小按钮的 NSWindow。这可能吗?

【问题讨论】:

    标签: objective-c cocoa nswindow


    【解决方案1】:

    创建NSWindow的自定义子类并覆盖“standardWindowButton:forStyleMask:”类方法

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

    【讨论】:

      猜你喜欢
      • 2016-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-20
      • 2016-01-15
      • 2017-06-21
      • 2016-10-30
      • 1970-01-01
      相关资源
      最近更新 更多