orient a uiimageView to the center of the screen
Well I have several images of plans that, every time we open the application, are created at a random position. What I want, is that every time a plan is created, his nose is oriented to the center of the screen, I think that I must calculate the angle between the center and the imag开发者_如何学运维e and then do a rotation, but I'm not sure . Can you help me please ! sorry for my english I'm french :/
myimageview.transform = CGAffineTransformMakeRotation(30 * M_PI / 180.0);
//this will rotate it by 30 degres. good luck!
to get the angle that you need you need to do trig.
http://en.wikipedia.org/wiki/Sine
精彩评论