我试图为一个空表单字段制作动画指示器,所以我使用下面的方法来动画到一个位置、反转动画并重复。在模拟器上这个方法可以正常工作,在我的3GS上看起来当完成块被调用时会出现闪烁。指示器会短暂地显示在中间位置,而不是回到原点。您有什么想法为什么会发生这种情况吗?谢谢。
- (void)bounceFormIndicator {
if (formIndicator.superview == nil) {
return;
}
int bounceDistance = 24;
[UIView animateWithDuration:0.6
delay:0
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionAllowUserInteraction
animations:^{
CGRect indicatorFrame = formIndicator.frame;
indicatorFrame.origin.x += bounceDistance;
formIndicator.frame = indicatorFrame;
}completion:^(BOOL finished){
CGRect indicatorFrame = formIndicator.frame;
indicatorFrame.origin.x -= bounceDistance;
formIndicator.frame = indicatorFrame;
[self bounceFormIndicator];
}];
}