iOS Developer Library — Pre-Release

Developer

GameController Framework Reference GCControllerElement Class Reference

Options
Deployment Target:

On This Page
Language:

GCControllerElement

A GCControllerElement object represents a measurable value on a controller profile. Typically, elements are mapped to physical controls on a controller. When a player manipulates those controls, the element object’s values change. The GCControllerElement class is never instantiated directly. Instead, subclasses that represent the different kinds of elements are instantiated. Table 1 lists the supported element types.

Table 1Kinds of controller elements

Class

Description

GCControllerAxisInput

An element that measures movement along an axis.

GCControllerButtonInput

An element that measures a button press.

GCControllerDirectionPad

An element that measures movement across two different axes.

An element class usually represents an isolated element, such as a button, whose values can be read. However, an element can itself have child elements. For example, a direction pad is a two-dimensional control whose values can either be read as a pair of axis elements or four button elements. If an element is a child of another element, its collection property points to its parent element.

The analog property determines whether the element returns a range of values or discrete (digital) values.

Conforms To


Import Statement


Swift

import GameController

Objective-C

@import GameController;

Availability


Available in iOS 7.0 and later.
  • analog analog Property

    Returns a Boolean value that indicates whether the element provides analog data. (read-only)

    Declaration

    Swift

    var analog: Bool { get }

    Objective-C

    @property(readonly, getter=isAnalog) BOOL analog

    Discussion

    If the value is YEStrue, then the value properties defined by the element subclass can return a range (from minimum to maximum) of possible values. For example, this element might be a pressure-sensitive button or an axis of a thumb stick that allows for a range of physical movement. If the value is NOfalse, then the element’s value properties only provides discrete values, typically 0 if the element is off, and 1 if the element is on.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later.

  • Returns the element that this element is part of. (read-only)

    Declaration

    Swift

    weak var collection: GCControllerElement! { get }

    Objective-C

    @property(assign, readonly) GCControllerElement *collection

    Discussion

    If the element is part of another element, this property holds the parent element. Otherwise, it holds nil.

    Import Statement

    Objective-C

    @import GameController;

    Swift

    import GameController

    Availability

    Available in iOS 7.0 and later.