如何在特定位置将NSWindow显示为工作表 [英] How to show an NSWindow as sheet at specific location

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

问题描述

我有一个这样的窗口,有3个子视图,每个都有按钮。点击这些 - 我需要显示工作表。

I have a window like this, having 3 subviews, each one of them has button. On click of those- I need to show sheet.

通过使用此代码,工作表位于窗口的中央。

By using this code, sheet comes in centre of the window.

- (IBAction)closeSubWindow:(id)sender{
    [NSApp endSheet:self.subWindow];
    [self.subWindow orderOut:nil];

}

- (IBAction)showSubWindow:(id)sender {
    [NSApp beginSheet:self.subWindow
       modalForWindow:self.window
        modalDelegate:self
       didEndSelector:nil
          contextInfo:nil];
}

是否有任何选项或方法在特定co -ordinates?

编辑:

我当前的实现是使用 NSPopover

My current implementation is by using NSPopover. Can I make this NSPopover to animate like sheet?

推荐答案

取一个请参阅 NSWindow 委托方法 -window:willPositionSheet:usingRect:

Take a look at the NSWindow delegate method -window:willPositionSheet:usingRect:

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

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