【问题标题】:cocoa sheet on document-based app基于文档的应用程序上的可可表
【发布时间】:2013-07-10 15:26:41
【问题描述】:

我得到了一个对话框而不是工作表。当应用程序不是基于文档时它可以工作。 现在不行了。

    - (IBAction) showSheet:(NSWindow*)window
{
    // User has asked to see the dialog. Display it.
    NSLog(@"%@", self.contragentsSheet);
    if (!_contragentsSheet)
        [NSBundle loadNibNamed: @"contragentsSheet" owner: self];
    [NSApp beginSheet:self.contragentsSheet
       modalForWindow: [[NSApp delegate]window]
       //modalForWindow: window
        modalDelegate: self
       didEndSelector: NULL
          contextInfo: NULL];
    //[contragentSearch becomeFirstResponder];
    //NSLog ( @"Sheet is launched");
    NSLog(@"%@", [[NSApp delegate]window]);


}

【问题讨论】:

    标签: cocoa document-based


    【解决方案1】:

    不要使用[[NSApp delegate] window],您需要明确告诉方法您要在哪个窗口上显示工作表。基于文档的应用程序可以有多个窗口,并且一个工作表附加到一个窗口。

    【讨论】:

    • 我不知道如何访问创建项目时生成的Document.xib中的那个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多