iOS Developer Library — Pre-Release

Developer

GameController Framework Reference GCControllerButtonInput Class Reference

Options
Deployment Target:

On This Page
Language:

GCControllerButtonInput

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

Inheritance


Conforms To


Import Statement


Swift

import GameController

Objective-C

@import GameController;

Availability


Available in iOS 7.0 and later.
  • pressed pressed Property

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

    Declaration

    Swift

    var pressed: Bool { get }

    Objective-C

    @property(readonly, getter=isPressed) BOOL pressed

    Import Statement

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later.

  • value value Property

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

    Declaration

    Swift

    var value: Float { get }

    Objective-C

    @property(readonly) float value

    Discussion

    If pressure is being applied to the button, then the pressed property is YEStrue and this property indicates the amount of pressure being applied to the button. The pressure value is normalized to a number between 0.0 (minimum pressure) and 1.0 (maximum pressure).

    If no pressure is being applied to the button, then the pressed property is NOfalse and this property holds a value of 0.0.

    Import Statement

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later.

Data Types

  • Signature for the block executed if a button changes values.

    Declaration

    Swift

    typealias GCControllerButtonValueChangedHandler = (GCControllerButtonInput!, Float, Bool) -> Void

    Objective-C

    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 amount of pressure being applied to the button. This value is used in conjunction with the pressed parameter. If pressure is being applied to the button, then the pressed parameter is YEStrue and this parameter indicates the amount of pressure being applied to the button. The pressure value is normalized to a number between 0.0 (minimum pressure) and 1.0 (maximum pressure).

    If no pressure is being applied to the button, then the pressed parameter is NOfalse and this parameter holds a value of 0.0.

    pressed

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

    This block type is used by the valueChangedHandler and pressedChangedHandler properties.

    Import Statement

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later.