Question

Does anyone know if it's possible to get the tilt direction when using CMAttitude. For example I would like to know when the phone is tilted forward vs. backward. It seems the data that comes back is the same value regardless of forward or backward. I also tried changing the output to degrees with

#define degrees(x) (180.0 * x / M_PI)

Which again only brings back the same degrees regardless of which way the phone is tilted.

Thanks.

Was it helpful?

Solution

CMAttitude should report the "attitude" of the phone in terms of its orientation in respect of the earth, as stated by the docs:

An instance of the CMAttitude class represents a measurement of the device’s attitude at a point in time. "Attitude” refers to the orientation of a body relative to a given frame of reference.

So IF the compass bearing of Core Location's CLHeading does not help then you should be able to say which way the device is pointing (forward vs backwards) have a look at my question and answer here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top