如何将NSPanel显示为工作表 [英] How to show a NSPanel as a sheet

查看:346
本文介绍了如何将NSPanel显示为工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将NSPanel显示为工作表。我每天都在做这些事情:

I'm trying to show a NSPanel as a sheet. I'm naively doing something along those lines:

SheetController *sheetController = [[[SheetController alloc]
                                      initWithWindowNibName:@"Sheet"] autorelease];

[[NSApplication sharedApplication] beginSheet:sheetController.window 
                               modalForWindow:self.window
                                modalDelegate:self
                               didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) 
                                  contextInfo:nil];

由于某种原因,我不能使用,这不工作。当这部分代码被调用时,页面瞬间闪烁(因为 autorelease 消息)。

For some reason that eludes me, this isn't working. When this part of the code is called, the sheet momentarily flashes (because of the autorelease message). The sheet is never hooked to window.

如果任何人都可以指向我可以找到更多信息,那将是非常感激。

If anyone can point me to where I can find more information, that would be very appreciated.

推荐答案

这听起来像是检查IB中面板的Visible at Launch框的经典案例。关闭它。

This sounds like a classic case of having checked the "Visible at Launch" box for the panel in IB. Turn that off.

这篇关于如何将NSPanel显示为工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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