I have a UIImageView that is an image of the star. The problem is I want the star to rotate when I move it. How can I rotate a UIImageView to make it look like it is spinning for 3 seconds. I want it to spin 720 degrees.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For a very simple approach, you can use
where
radianRotationis a float, e.g. 4*pi for 720 degrees. You can play with basic animations and changing the rotation however you like.However, if you want a more sophisticated solution, then I highly recommend you look at the answers to this related post: how to rotate UIIMageVIew with fix point?
Also, see the myriad related posts linked on the right hand side of your screen. Many have all the code you need (barring going around in a circle twice).