GCControllerDirectionPad Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/GameController.framework
Availability
Available in iOS 7.0 and later.
Companion guide
Declared in
GCControllerDirectionPad.h

Overview

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).

Tasks

Reading the Directional Pad as a Pair of Axes

Reading the Directional Pad as a Four Directional Buttons

Receiving Notifications When the Directional Pad’s Values Change

Properties

down

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

@property(readonly) GCControllerButtonInput *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.
Declared In
GCControllerDirectionPad.h

left

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

@property(readonly) GCControllerButtonInput *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.
Declared In
GCControllerDirectionPad.h

right

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

@property(readonly) GCControllerButtonInput *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.
Declared In
GCControllerDirectionPad.h

up

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

@property(readonly) GCControllerButtonInput *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.
Declared In
GCControllerDirectionPad.h

valueChangedHandler

A handler to be called when the directional pad element changes values.

@property(copy) GCControllerDirectionPadValueChangedHandler valueChangedHandler
Availability
  • Available in iOS 7.0 and later.
Declared In
GCControllerDirectionPad.h

xAxis

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

@property(readonly) GCControllerAxisInput *xAxis
Availability
  • Available in iOS 7.0 and later.
Declared In
GCControllerDirectionPad.h

yAxis

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

@property(readonly) GCControllerAxisInput *yAxis
Availability
  • Available in iOS 7.0 and later.
Declared In
GCControllerDirectionPad.h

Constants

GCControllerDirectionPadValueChangedHandler

Signature for the block executed when either axis changes values.

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.

Availability
  • Available in iOS 7.0 and later.
Declared In
GCControllerDirectionPad.h