Cocoaはさっぱり!
■ このスレッドは過去ログ倉庫に格納されています
0622名称未設定
02/06/29 14:58ID:3EKJ3569Thread使わないでTimerはどう?
- (void)beginSheet {
[NSApp beginSheet:sheet
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
[NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(run:)
userInfo:nil
repeats:YES];
}
- (void)run:(NSTimer *)timer {
//メインの処理: 実行中は描画が止まるので、処理をテキトーに分割してこのメソッドはすぐ終了させる
[indicator incrementBy:1.0];
//すべて処理が終了した場合
[timer invalidate];
[NSApp endSheet:sheet];
}
こんな感じでどうか
もしかしたらindicatorの値にlockを設定して、indicatorの値変更はTimerでやって、メインの処理はThreadを使った方がいいかも
別ThreadでNSViewを扱うときはlockFocusすりゃいいんだっけ?
■ このスレッドは過去ログ倉庫に格納されています