gpt4 book ai didi

cocoa 片不是模态的

转载 作者:行者123 更新时间:2023-12-03 16:28:43 25 4
gpt4 key购买 nike

我不明白为什么工作表不是模态的并且焦点仍然在主窗口上。

- (IBAction) showSheet:(NSWindow*)window

{ //用户要求查看该对话框。显示它。

    if (!_clientsDialog)
[NSBundle loadNibNamed: @"clientsDialog" owner: self];
[NSApp beginSheet:self.clientsDialog
modalForWindow: [[NSApp delegate]window]
modalDelegate: self
didEndSelector: NULL
contextInfo: NULL];

}

最佳答案

以下方法对我有用:

头文件:

- (IBAction)showSheet:(id)sender;

方法文件:

- (void)showSheet:(id)sender {

if (! _clientsDialog)
[NSBundle loadNibNamed: @"clientsDialog" owner: self];

[NSApp beginSheet: _clientsDialog
modalForWindow: [[NSApp delegate] window]
modalDelegate: self
didEndSelector: NULL
contextInfo: NULL];
}

重要提示:您的窗口上需要有一个标题栏。否则控件将无法工作。

enter image description here

关于 cocoa 片不是模态的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17510377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com