iOS Developer Library — Prerelease

Developer

Game Controller Framework Reference GCControllerDirectionPad Class Reference

Options
Deployment Target:

On This Page
Language:

GCControllerDirectionPad

A GCControllerDirectionPad object represents a two-dimensional control such as a directional pad or a thumbstick. This element does not provide values of its own. Instead, its values are provided by its child elements. It provides two sets of children that map to the same physical controls, so your app can view the directional pad as either either a pair of axis elements (horizontal, vertical), or four button elements (up, down, left, right).

  • The value of the directional pad along the horizontal axis (left and right). (read-only)

    Declaration

    Swift

    var xAxis: GCControllerAxisInput { get }

    Objective-C

    @property(nonatomic, readonly) GCControllerAxisInput * _Nonnull xAxis

    Availability

    Available in iOS 7.0 and later.

  • The value of the directional pad along the vertical axis (up and down). (read-only)

    Declaration

    Swift

    var yAxis: GCControllerAxisInput { get }

    Objective-C

    @property(nonatomic, readonly) GCControllerAxisInput * _Nonnull yAxis

    Availability

    Available in iOS 7.0 and later.

  • up up Property

    A measurement of how far up the directional pad has been moved. (read-only)

    Declaration

    Swift

    var up: GCControllerButtonInput { get }

    Objective-C

    @property(nonatomic, readonly) GCControllerButtonInput * _Nonnull up

    Discussion

    The value of the up property is mutually exclusive with the value of the down property. This means that whenever the value of the up property is non-zero, the value of the down property is 0.

    Availability

    Available in iOS 7.0 and later.

  • down down Property

    A measurement of how far down the directional pad has been moved. (read-only)

    Declaration

    Swift

    var down: GCControllerButtonInput { get }

    Objective-C

    @property(nonatomic, readonly) GCControllerButtonInput * _Nonnull down

    Discussion

    The value of the down property is mutually exclusive with the value of the up property. This means that whenever the value of the down property is non-zero, the value of the up property is 0.

    Availability

    Available in iOS 7.0 and later.

  • left left Property

    A measurement of how far left the directional pad has been moved. (read-only)

    Declaration

    Swift

    var left: GCControllerButtonInput { get }

    Objective-C

    @property(nonatomic, readonly) GCControllerButtonInput * _Nonnull left

    Discussion

    The value of the left property is mutually exclusive with the value of the right property. This means that whenever the value of the left property is non-zero, the value of the right property is 0.

    Availability

    Available in iOS 7.0 and later.

  • A measurement of how far right the directional pad has been moved. (read-only)

    Declaration

    Swift

    var right: GCControllerButtonInput { get }

    Objective-C

    @property(nonatomic, readonly) GCControllerButtonInput * _Nonnull right

    Discussion

    The value of the right property is mutually exclusive with the value of the left property. This means that whenever the value of the right property is non-zero, the value of the left property is 0.

    Availability

    Available in iOS 7.0 and later.

Data Types

  • Signature for the block executed when either axis changes values.

    Declaration

    Swift

    typealias GCControllerDirectionPadValueChangedHandler = (GCControllerDirectionPad, Float, Float) -> Void

    Objective-C

    typedef void (^GCControllerDirectionPadValueChangedHandler)(GCControllerDirectionPad *dpad, float xValue, float yValue)

    Discussion

    The block parameters are defined as follows:

    dpad

    The axis element whose value changed.

    xValue

    The new value of the x-axis, measured from -1 to 1.

    yValue

    The new value of the y-axis, measured from -1 to 1.

    This block type is used by the valueChangedHandler property.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later.