Resise NSWindow,不显示调整大小按钮 [英] Resise NSWindow without showing resize button

查看:550
本文介绍了Resise NSWindow,不显示调整大小按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

创建NSWindow的自定义子类并重写standardWindowButton:forStyleMask:类方法

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

这篇关于Resise NSWindow,不显示调整大小按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆