How do I have to use the accelerometer / gyroscope in objective-c in order to find out if…
A) the iPhone is held just in front of the users face, i.e. it is held “upwards” or
B) the iPhone has been put for instance on a table, i.e. the display is facing up.
Firstly conform to
<UIAccelerometerDelegate>and then you can use these methods:Measure X, Y and Z. Z is the axis on the screen, Y top to bottom and X left to right.
In viewDidLoad call
[self startMeasuringAcceleration]to startHope that helps.