0

このloadFileメソッドはNSTimer、whileループでアプリケーションをブロックすることなく、時間の経過とともにプロセスにファイルをロードすることを開始します。このタイマーは、コードの最初のビットでは起動せず、2番目のビットで起動します。問題は、2番目のビットがシートをシートではなくパネルスタイルのウィンドウとして表示することです。

まだ機能するシートを入手するにはどうすればよいですか?

シートを表示しますが、作業は行われません

[self.sheetView loadFile:filename];
[[NSApplication sharedApplication] beginSheet: self.sheetView
                               modalForWindow: self.window
                                modalDelegate: self
                               didEndSelector: nil
                                  contextInfo: nil];
[[NSApplication sharedApplication] runModalForWindow: self.sheetView];

ウィンドウを表示すると作業が完了します

NSModalSession session = [NSApp beginModalSessionForWindow:self.sheetView];
NSInteger result = NSRunContinuesResponse;

[self.sheetView loadFile:filename];

// Loop until some result other than continues:
while (result == NSRunContinuesResponse)
{
    // Run the window modally until there are no events to process:
    result = [NSApp runModalSession:session];

    // Give the main loop some time:
    [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
}

[NSApp endModalSession:session];
4

1 に答える 1

0

NSThread使用できない理由はありますか?それは明らかな答えです...

于 2012-02-13T06:46:43.623 に答える