Categories
gyroscope ios iphone objective-c swift

Determine the Device Orientation and its resulting Angle on one Dimension?

I have the following setup:

enter image description here

An iPhone lies with the display to the ceiling on a table (alpha = 0 degrees). When the iPhone is moved upwards like shown in the image above the alpha angle increases.

How do I compute the value of the alpha angle without taking care of any other axes which could change. I am only interested in this one axis.

How do I get the correct alpha angle the iPhone has when lifting up from the table? How do I get notified when the value of alpha changes?