iOS Developer Library

Developer

UIKit Framework Reference UIAccelerometerDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

UIAccelerometerDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 2.0 and later.

The UIAccelerometerDelegate protocol defines a single method for receiving acceleration-related data from the system. Implementation of this method is optional, but expected.

  • Delivers the latest acceleration data to the delegate.

    Declaration

    Objective-C

    - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration

    Parameters

    accelerometer

    The application-wide accelerometer object.

    acceleration

    The most recent acceleration data.

    Discussion

    The shared UIAccelerometer object invokes this method at the desired interval, providing your delegate with updated acceleration data each time.

    This method is always invoked on your application’s main thread when it is in the NSDefaultRunLoopMode run loop mode.

    Import Statement

    Objective-C

    @import UIKit;

    Availability

    Available in iOS 2.0 and later.

    Deprecated in iOS 5.0.