ウィンドウのサイズ変更時にビューを別の位置に移動させたい。現在、NSWindowDidResizeNotification の受信時に NSViewAnimation でこれを行っています。
// Create the view animation object.
theAnim = [[NSViewAnimation alloc] initWithViewAnimations:animation];
// Set some additional attributes for the animation.
[theAnim setDuration:1]; // One and a half seconds.
[theAnim setAnimationCurve:NSAnimationEaseIn];
[theAnim setFrameRate:20.0];
[theAnim setAnimationBlockingMode:NSAnimationNonblocking];
// Run the animation.
[theAnim startAnimation];
// The animation has finished, so go ahead and release it.
[theAnim release];
(「アニメーション」は、NSAnimation が必要とするように、ビューの新しい四角形を含む dict を持つ配列です) ウィンドウのサイズを変更すると、このコードが複数回呼び出されます。したがって、サイズを変更すると、このコードは 1 回のサイズ変更で約 20 回呼び出されます。ビューが動くアニメーションが 20 個あります。20種類が重なります。(多くの異なるビューのように見えますが、アニメーション間を移動するのと同じものだと思います)
iPhone では、移動するビューのみがあり、[UIView setAnimationBeginsFromCurrentState:YES] を設定すると機能します。OSXでこれを行う方法はありますか? ビューに isAnimating 変数を作成することはできますが、その変数は 1 つの位置にしか移動せず、アニメーション中のクイック サイズ変更を無視します。
OSXでこれを行うにはどうすればよいですか? ありがとう