UIAccelerometer Detecting angle Problem

Posted by mactalent on Stack Overflow See other posts from Stack Overflow or by mactalent
Published on 2010-02-22T06:28:34Z Indexed on 2010/04/12 2:03 UTC
Read the original article Hit count: 676

Filed under:
|

Hello All,

How to detect the iPhone angle? I mean that when iPhone is straight (i.e) HomeButton is in bottom part, so how to detect 90 Degree from UIAccelerometer Method.

CGFloat RadiansToDegrees(CGFloat radians) {return radians * 180/M_PI;};

i try RadiansToDegrees(atan2(acceleration.y, acceleration.x)) but it gives -90 degree angle

any helpwould be appreciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about accelerometer