0

アニメーションを実行するオブジェクトがあります...同時にアニメーションを実行しているオブジェクトが多数(25以上)ある場合、ドラッグ中にジャークが発生します...各オブジェクトで以下のコードを使用してアニメーションを作成しています。どうすればパフォーマンスを向上させることができますか?

#define DEFAULT_ANIM_SPPED 0.6
#define INFINATE_VALUE 1e100f

- (void)startAnimating
{
    mBackgroundImageView.frame = mOriginalFrame;
    [UIView beginAnimations:nil context:nil];

    [UIView setAnimationRepeatAutoreverses:YES];
    [UIView setAnimationRepeatCount:INFINATE_VALUE];
    [UIView setAnimationDuration:DEFAULT_ANIM_SPPED];   

    CGRect tempFrame=mBackgroundImageView.frame;
    tempFrame.origin.y -= mAnimationOffset;
    mBackgroundImageView.frame=tempFrame;
    [UIView commitAnimations];
}
4

1 に答える 1

0

ビューごとにアニメーションを作成するのではなく、たとえば共通のスーパービューで、複数のビューをアニメーション化する1つのアニメーションブロックを作成してみてください。あなたのケースで25ビューに対して十分な改善が得られるかどうかはわかりません。

于 2011-02-10T06:55:43.787 に答える