Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You want to be able to retrieve information about the device’s motion from the gyroscope hardware on an iOS device.
Follow these steps:
Find out whether the gyroscope hardware is available on the iOS device. Please refer to Recipe 16.2 for directions on how to do this.
If the gyroscope hardware is available, make sure it is not already sending you updates. Please refer to Recipe 16.2 for directions.
Use the setGyroUpdateInterval: instance method
of CMMotionManager to set the
number of updates you want to receive per second. For instance,
for 20 updates per second (one second), set this value to
1.0/20.0.