例如,我在横向状态下使用动画,持续时间为5.0秒,从状态A到B;在5.0s的中间,我可以将iPad从横向旋转到纵向。我希望动画停止并在旋转后将UI状态设为C.
我不确定我的问题是否清楚。 我怎么能这样做?
我的动画代码:
- (void)moveImage:(UIImageView *)image duration:(NSTimeInterval)duration x:(NSNumber*)dx y:(NSNumber*)dy
{
// Setup the animation
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationBeginsFromCurrentState:YES];
// The transform matrix
float fx = [dx floatValue];
float fy = [dy floatValue];
CGAffineTransform transform = CGAffineTransformMakeTranslation(fx, fy);
//CGAffineTransform transform = CGAffineTransformMakeRotation(0.4);
//CGAffineTransform transform = CGAffineTransformMakeScale(2.0, 2.0);
image.transform = transform;
// Commit the changes
[UIView commitAnimations];
}
答案 0 :(得分:2)
所以我们要做的就是1)来自2)