2012-02-13 4 views
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]; 

答えて

0

に行われNSThreadが使用できない理由はありますか?それは明白な答えです...

+0

パネル上のカスタムビューでアニメーションを正しく表示するためのNSTimerのタイミング。私はNSThreadでもそうすることができると思いますが、必要がなければ、余分なマイル(そしてNSThreadを学ぶ必要はありません)を望んでいませんでした。 – Justin808

関連する問題