Classes

The following classes are available globally.

  • A simple implementation of a joystick interface like those found on classic arcade games. This implementation detects and reports two values when the joystick moves:

    • angle: the direction the handle is pointing. Unit is degrees with 0° pointing up (north), and 90° pointing right (east).
    • displacement: how far from the view center the joystick is moved in the above direction. It has no units as it is the ratio of distance moved from center over the radius of the joystick base. Always in range 0.0-1.0.

    The view has several settable parameters that be used to configure a joystick’s appearance and behavior:

    • monitor: an enumeration of type JoyStickViewMonitorKind that can hold a function to receive updates when the joystick’s angle and/or displacement values change. Supports polar and cartesian (XY) reporting
    • movable: a boolean that when true lets the joystick move around in its parent’s view when there joystick moves beyond displacement of 1.0.
    • movableBounds: a CGRect which limits where a movable joystick may travel
    • baseImage: a UIImage to use for the joystick’s base
    • handleImage: a UIImage to use for the joystick’s handle

    Additional documentation is available via the attribute names below.

    See more

    Declaration

    Swift

    @IBDesignable
    public final class JoyStickView : UIView
    extension JoyStickView: UIGestureRecognizerDelegate