开发者

orient a uiimageView to the center of the screen

开发者 https://www.devze.com 2023-03-17 08:10 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消