Skip to content

didwndckd/JCJoystick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JCJoystick

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

JCJoystick is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'JCJoystick'

Usage

Basic

let joystickView = JCJoystickView()
joystickView.delegate = self

basic

Delegate

public protocol JCJoystickViewDelegate: AnyObject {
    func joystickView(joystickView: JCJoystickView, shouldDrag value: JCJoystickValue) -> Bool
    func joystickView(joystickView: JCJoystickView, beganDrag value: JCJoystickValue)
    func joystickView(joystickView: JCJoystickView, didDrag value: JCJoystickValue)
    func joystickView(joystickView: JCJoystickView, didEndDrag value: JCJoystickValue)
}

Options

  • image

    let joystickView = JCJoystickView()
    joystickView.boundaryImage = <yourImage>
    joystickView.thumbImage = <yourImage>
  • angleValueType

    let joystickView = JCJoystickView()
    joystickView.angleValueType = .degree
    // or
    joystickView.angleValueType = .radian

    angleType

  • thumbLimitStyle

    let joystickView = JCJoystickView()
    joystickView.thumbLimitStyle = .inside
    //or
    joystickView.thumbLimitStyle = .center
    //or
    joystickView.thumbLimitStyle = .outside
    //or
    joystickView.thumbLimitStyle = .unlimited
    //or
    joystickView.thumbLimitStyle = .customWithConstant(constant: 20)
    //or
    joystickView.thumbLimitStyle = .customWithMultiplier(multiplier: 1.5)

    thumbLimitStyle

  • thumbSizeMultiplier

    let joystickView = JCJoystickView()
    joystickView.thumbSizeMultiplier = 0.25

    thumbSizeMultiplier

Author

JoongChangYang, didwndckd@gmail.com

License

JCJoystick is available under the MIT license. See the LICENSE file for more info.