Reputation: 651
When I tilt the iphone on the xy plane how we can get how much it has been tilted? IPhone is being held as vertical upright position
Upvotes: 1
Views: 306
Reputation: 1634
CMMotionManager
CMMotionManager works with NSOperationQuee. CMMotionManager provides the startAccelerometerUpadatesToQueue:withHandler method to start Core Motion data collecting. And this method uses a threaded context by implementing an NSOperationQueue and an execution block that confomrs to the CMAccelerometerHandler format.
Core Motion data is always provided as radians. If you want degrees you will need to convert the data using the following formulas:
CGFloat DegreesToRadians(CGFloat degrees) { return degrees * M_PI / 180; };
CGFloat RadiansToDegrees(CGFloat radians) { return radians * 180 / M_PI; };
Upvotes: 2