この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];