0

私は、さまざまなメソッドと遅延-(void)animationStartで構成されたメソッドを持っています。[self performSelector:@selector(myAnimation) withObject:nil afterDelay: 21 * 0.01];

を使用しないようにコードをリファクタリングするにはどうすればよいperformSelectorですか? アニメーションを結果的に変更するために使用します。

4

1 に答える 1

2

アニメーション自体を正確に実行する方法は指定しませんが、UIView アニメーション ブロックを使用すると、遅延を指定することもできます ( animateWithDuration:delay:options:animations:completion:)。

NSTimerまたは、遅延を実行するために使用できます。

ただし、詳細な回答を得るには、アニメーションの実行方法に関する詳細を提供する必要があります。

アップデート

アニメーション ブロックの使用は非常に簡単です...完了ブロック (以下のコードを参照) では、フォローアップ アニメーション (一連のアニメーション) を開始できます。並列アニメーション処理では、アニメーションの複数のブロックを開始するだけです...さまざまなメッセージがあります。アニメーションの終了を処理する必要がない場合は、完了ブロックのないものを使用できます。

次に例を示します。

[UIView animateWithDuration:2.0 delay:0.1 options:UIViewAnimationOptionCurveEaseInOut animations:^{

    // perform animation code here

} completion:^(BOOL finished) {

    // This code is performed after the animation is completed. E.g. you can start a new animation here
    // (for serial animation processing):

}];
于 2013-09-20T08:07:49.867 に答える