Ios5 iPod Touch iOS 5动画口吃
我有一个UIView,在我的应用程序中作为一个徽章,按下一个按钮,徽章应该会闪烁,然后做一个漂亮的挤压和拉伸动画。该动画在iPhone4、iPhone4S和iPhone5上都能完美运行,但8GB iPodtouch(第四代)iOS5.1.1的口吃效果非常糟糕 popWithDuration:方法会导致口吃,而resetCount方法会导致视图大小爆炸。想知道是否有人知道任何修复或解决方法 下面是相关的方法,该类是UIView的一个子类Ios5 iPod Touch iOS 5动画口吃,ios5,ipod-touch,uianimation,Ios5,Ipod Touch,Uianimation,我有一个UIView,在我的应用程序中作为一个徽章,按下一个按钮,徽章应该会闪烁,然后做一个漂亮的挤压和拉伸动画。该动画在iPhone4、iPhone4S和iPhone5上都能完美运行,但8GB iPodtouch(第四代)iOS5.1.1的口吃效果非常糟糕 popWithDuration:方法会导致口吃,而resetCount方法会导致视图大小爆炸。想知道是否有人知道任何修复或解决方法 下面是相关的方法,该类是UIView的一个子类 - (void)popWithDuration:(CGFlo
- (void)popWithDuration:(CGFloat)duration
{
if(self.canAnimateLikedNumber)
{
if(self.waitingToReset){
[self resetCount];
return;
}
else
self.canAnimateLikedNumber = FALSE;
CGAffineTransform stretchTransform = CGAffineTransformMakeScale(1.5,1.5);
CGAffineTransform squashTransform = CGAffineTransformMakeScale(1.0,1.0);
[UIView animateWithDuration:duration delay:0.0f options:UIViewAnimationOptionLayoutSubviews animations:^{
[self setAlpha:1.0f];
[self setTransform:stretchTransform];
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.2f delay:0.0f options:UIViewAnimationOptionBeginFromCurrentState animations:^{
[self setTransform:squashTransform];
} completion:^(BOOL finished) {
self.canAnimateLikedNumber = TRUE;
if(self.waitingToReset){
[self resetCount];
return;
}
}];
}];
}
}
- (void) resetCount
{
if([NSString isValid: self.savedCountLabel.text] || (!self.hidden && self.superview))
{
if(self.canAnimateLikedNumber)
{
self.canAnimateLikedNumber = FALSE;
CGSize defaultSize = [NotificationBadge DefaultBadgeSize];
CGRect originalRect = CGRectMake(self.frame.origin.x, self.frame.origin.y, defaultSize.width, defaultSize.height);
[UIView animateWithDuration:0.2 delay:0.0f options:UIViewAnimationOptionLayoutSubviews animations:^{ //squash and stretch
[self setTransform:CGAffineTransformMakeScale(2, 2)];
}
completion:^(BOOL finished)
{
[UIView animateWithDuration:0.4 delay:0.0f options:UIViewAnimationOptionLayoutSubviews animations:^{
[self setTransform:CGAffineTransformMakeScale(0.0,0.0)];
[self setAlpha:0.0f];
}
completion:^(BOOL finished)
{
[self setHidden:TRUE];
[self setTransform:CGAffineTransformMakeScale(1.0,1.0)];
[self setFrame:originalRect];
[self.savedCountLabel setText:@"0"];
[self.savedCountLabel setFrame:CGRectMake(NOTIFICATION_LABEL_INSETS.left, NOTIFICATION_LABEL_INSETS.top, defaultSize.width - NOTIFICATION_LABEL_INSETS.left - NOTIFICATION_LABEL_INSETS.right, defaultSize.height - NOTIFICATION_LABEL_INSETS.top - NOTIFICATION_LABEL_INSETS.bottom)];
self.canAnimateLikedNumber = TRUE;
self.waitingToReset = FALSE;
}];
}];
}
else
{
self.waitingToReset = TRUE;
}
}
}
我明白了。显然,如果在iOS 5.0+中使用transform属性,则无法将transform值设置为0.0f 归功于