【问题标题】:Zoom window for new documents to full screen将新文档的窗口缩放到全屏
【发布时间】:2014-04-07 17:56:14
【问题描述】:

这应该很简单,但我在 SO 或 Google 上都找不到关于这个主题的任何内容,所以..

将新文档窗口缩放到全屏的最佳方式是什么(即不是全屏模式,而只是最大化窗口) NSDocument 基于应用程序?

它甚至可能是在NSDocumentNSWindowController 中覆盖的某种方法,但我无法找到它。还是我们应该在 initWithType:error: 方法的某个地方手动执行此操作..?

【问题讨论】:

    标签: cocoa nswindow appkit nsdocument nswindowcontroller


    【解决方案1】:

    使用performZoom: 模拟单击​​窗口的绿色“缩放”按钮。

    您的窗口从windowWillUseStandardFrame:defaultFrame: 获取缩放大小。在此处返回修改后的NSRect,以缩放到默认缩放帧以外的大小。

    - (void)windowDidLoad {
        [super windowDidLoad];
    
        [self.window performZoom:self];
    }
    
    - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame {
        // Implement a custom zoomed window size here, or return the default zoomed size.
        return newFrame;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-31
      • 2013-11-20
      • 1970-01-01
      • 2018-09-17
      • 2013-08-14
      相关资源
      最近更新 更多