Z
Z
zobov2012-03-07 14:43:12
iOS
zobov, 2012-03-07 14:43:12

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

1 answer(s)
I
iSheeZ, 2012-03-20
@iSheeZ

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 question

Ask a Question

731 491 924 answers to any question