Answer the question
In order to leave comments, you need to log in
Xcode object rotation?
Hello. There was such a problem.
We need to create a visual effect of finding an object inside the phone screen. Let's say this is a picture of a coin.
Now she hangs inside with the help of an accelerometer.
Now I need to make it so that when I roll it along one of the walls, it naturally rotates.
How can this be implemented?
Answer the question
In order to leave comments, you need to log in
You were going in the right direction:
yourObject.transform = CGAffineTransformMakeRotation(1 * rotate * M_PI / 90);
Where:
1 - clockwise rotation (-1 - against)
rotate - the angle on which to rotate.
If it is important how it will spin, I advise you to add CABasicAnimation for smooth rotation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question