UIView rotate and than move
Posted
by
user1790354
on Stack Overflow
See other posts from Stack Overflow
or by user1790354
Published on 2012-11-01T04:43:06Z
Indexed on
2012/11/01
5:00 UTC
Read the original article
Hit count: 148
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.
© Stack Overflow or respective owner