このサイトから引用: http://www.mactech.com/articles/mactech/Vol.21/21.08/Threads/index.html
ムービーが非常に大きい場合、この方法では完了するまでにかなりの時間がかかることがあります。その間、ユーザーはウィンドウを移動する以外、アプリケーションで何もできません。あまりエキサイティングではありません。
少し良い解決策は、movie:shouldContinueOperation:withPhase:atPercent:withAttributes: デリゲート メソッドを使用することです。これは、エクスポートの進行状況を示すダイアログ ボックスを表示し、ユーザーが操作をキャンセルできるようにするために使用される、QuickTime のムービー進行機能のラッパーです。ここでこれを試してください
- (BOOL)movie:(QTMovie *)movie
shouldContinueOperation:(NSString *)op
withPhase:(QTMovieOperationPhase)phase
atPercent:(NSNumber *)percent
withAttributes:(NSDictionary *)attributes
{
OSErr err = noErr;
NSEvent *event;
double percentDone = [percent doubleValue] * 100.0;
switch (phase) {
case QTMovieOperationBeginPhase:
// set up the progress panel
[progressText setStringValue:op];
[progressBar setDoubleValue:0];
// show the progress sheet
[NSApp beginSheet:progressPanel
modalForWindow:[movieView window] modalDelegate:nil
didEndSelector:nil contextInfo:nil];
break;
case QTMovieOperationUpdatePercentPhase:
// update the percent done
[progressBar setDoubleValue:percentDone];
[progressBar display];
break;
case QTMovieOperationEndPhase:
[NSApp endSheet:progressPanel];
[progressPanel close];
break;
}
// cancel (if requested)
event = [progressPanel
nextEventMatchingMask:NSLeftMouseUpMask
untilDate:[NSDate distantPast]
inMode:NSDefaultRunLoopMode dequeue:YES];
if (event && NSPointInRect([event locationInWindow],
[cancelButton frame])) {
[cancelButton performClick:self];
err = userCanceledErr;
}
return (err == noErr);
}
お役に立てれば。
何か助けが必要な場合は、私に知らせてください。これが少し役立ったかどうか教えてください。
PK