0
loadFile
メソッドは、whileループでアプリケーションをブロックせずに時間の経過とともにファイルを処理するためにNSTimer
を開始します。このタイマーは、第1ビットのコードでは発火しておらず、第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];
パネル上のカスタムビューでアニメーションを正しく表示するためのNSTimerのタイミング。私はNSThreadでもそうすることができると思いますが、必要がなければ、余分なマイル(そしてNSThreadを学ぶ必要はありません)を望んでいませんでした。 – Justin808