UIView rotate and than move
- by user1790354
I have problem with rotating and moving image (UIView).
If I use this for rotate:
[UIView beginAnimations: @"rotate" contex: nil];
[UIView setAnimationDuration: 1];
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
spaceShip.transform = CGAffineTransformMakeRotation (angle); // spaceShip is the UIView
[UIView commitAnimations];
And this to move:
[UIView beginAnimations: @"move" contex: nil];
[UIView setAnimationDuration: 1];
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
spaceShip.center = destanation // destanation is a point where user tap
[UIView commitAnimations];
It's working well one at a time. But together this two animations don't work. Space Ship is rotating, but does not move in direction.
Where my mistake?
P.S. Early I have specify anchor point (0.5, 0.5). But when I rotate image it coordinates is changing.