【发布时间】:2011-06-24 02:38:37
【问题描述】:
我有一个执行动画的对象...如果有许多(超过 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];
}
【问题讨论】:
标签: iphone objective-c performance uiviewanimation