【发布时间】:2011-01-05 13:22:41
【问题描述】:
我正在尝试为 UIImage 视图设置动画,每次顺时针旋转 90 度。 出于某种原因,第一个旋转动画有效,但随后它停止了(即使另一个视图调整大小动画继续有效)。这是为什么? (我到处找,但找不到答案)
{
[btn setFrame:CGRectMake(previousX, previousY, BUTTON_WIDTH, BUTTON_HEIGHT)];
[self.view insertSubview:btn atIndex:0];
[UIView beginAnimations:@"ButtonAnimation" context:nil];
[UIView setAnimationDuration:2.5];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
CGRect rect = CGRectMake(previousX,previousY+BUTTON_HEIGHT,BUTTON_WIDTH,BUTTON_HEIGHT);
btn.frame = rect;
[UIView setAnimationBeginsFromCurrentState:YES];
++ButtonCounter;
if (ButtonCounter < [btnArray count])
{
[UIView setAnimationDidStopSelector:@selector(didStopReal)];
}
else
{
ButtonCounter = 0;
}
// The transform matrix
CGAffineTransform transform =
CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90));
imgArrowView.transform = transform;
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
}
-(void) didStopReal
{
[self animteReal:ButtonCounter];
}
【问题讨论】:
标签: iphone cocoa-touch uiimageview core-animation rotation