CMAccelerometerData Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/CoreMotion.framework
Availability
Available in iOS 4.0 and later.
Declared in
CMAccelerometer.h

Overview

An instance of the CMAccelerometerData class represents an accelerometer event. It is a measurement of acceleration along the three spatial axes at a moment of time.

An application accesses CMAccelerometerData objects through the block handler specified as the last parameter of the startAccelerometerUpdatesToQueue:withHandler: method and through the accelerometerData property, both declared by the CMMotionManager class. The superclass of CMAccelerometerData, CMLogItem, defines a timestamp property that records when the acceleration measurement was taken.

Tasks

Accessing Accelerometer Data

Properties

acceleration

The acceleration measured by the accelerometer. (read-only)

@property(readonly, nonatomic) CMAcceleration acceleration
Discussion

The description of the CMAcceleration structure type describes the fields used for measuring acceleration.

Availability
  • Available in iOS 4.0 and later.
Declared In
CMAccelerometer.h

Constants

CMAcceleration

The type of a structure containing 3-axis acceleration values.

typedef struct {
      double x;
      double y;
      double z;
} CMAcceleration;
Fields
x

X-axis acceleration in G's (gravitational force).

y

Y-axis acceleration in G's (gravitational force).

z

Z-axis acceleration in G's (gravitational force).

Discussion

A G is a unit of gravitation force equal to that exerted by the earth’s gravitational field (9.81 m s−2).

Availability
  • Available in iOS 4.0 and later.
Declared In
CMAccelerometer.h