GCControllerButtonInput Class Reference

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

Overview

A GCControllerButtonInput element measure a button press. This element can either be analog or digital.

Tasks

Reading the Button’s Value

Receiving Notifications When the Button’s Value Changes

Properties

pressed

A Boolean value that indicates whether the button is pressed. (read-only)

@property(readonly, getter=isPressed) BOOL pressed
Discussion

If you do not care about pressure sensitive controls, use this property instead of reading the value property.

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

value

The level of pressure being applied to the button. (read-only)

@property(readonly) float value
Discussion

The value of the button is normalized to be between 0 and 1 inclusive. A higher value indicates more pressure.

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

valueChangedHandler

A handler to be called when the button changes value.

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

Constants

GCControllerButtonValueChangedHandler

Signature for the block executed if a button changes values.

typedef void (^GCControllerButtonValueChangedHandler)(GCControllerButtonInput *button, float value, BOOL pressed)
Discussion

The block parameters are defined as follows:

button

The button element whose value changed.

value

The new value.

pressed

A Boolean value that indicates whether the button is considered pressed.

This block type is used by the valueChangedHandler property.

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