- iOS 2.0–5.0Deprecated
- Mac Catalyst 13.0–13.0Deprecated
Each acceleration event includes simultaneous acceleration readings along the three axes of the device, as shown in Figure 1.
The device accelerometer reports values for each axis in units of g-force, where a value of
1 represents acceleration of about +1 g along a given axis. When a device is laying still with its back on a horizontal surface, each acceleration event has approximately the following values:
Individual acceleration values are of type
UIAcceleration, equivalent to a
double. Values can range over the accelerations found in normal use of a device.
If you want to detect specific types of motion as gestures—specifically, shaking motions—use the
UIEvent class and its
UIEvent event type. For details, see Handling Tap and Long-Press Gestures in Event Handling Guide for UIKit Apps.