登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

支持圆形、竖直、横向的摇杆

[复制链接]
来自: CatchZeng 分类: iOS精品源码 上传时间: 2018-11-2 12:05:43
Tag:

项目介绍:

JoystickView

Version

License

Platform

support around,vertical,horizontal directions JoystickView

feature

Usage

1.init from code or xib. Do not forget set joystickBg and joystickThumb!


var joystickView = JoystickView()

joystickView.joystickBg = UIView()//replace with your custom background view

joystickView.joystickThumb = UIView()//replace with your custom thumb view

2.set delegate


joystickView.delegate = self

3.handle delegate


import JoystickView

class ViewController: UIViewController, JoystickViewDelegate{

    @IBOutlet weak var horizontalJoystick: JoystickView!

    @IBOutlet weak var verticalJoystick: JoystickView!

    override func viewDidLoad() {

        super.viewDidLoad()

        horizontalJoystick.form = .horizontal

        horizontalJoystick.delegate = self

        verticalJoystick.form = .vertical

        verticalJoystick.delegate = self

    }

    // MARK: JoystickViewDelegate

    func joystickView(_ joystickView: JoystickView, didMoveto x: Float, y: Float, direction: JoystickMoveDriection) {

        if joystickView == horizontalJoystick{

            print("horizontal joystick move to x:\(x) y:\(y) direction:\(direction.rawValue)")

        }else{

            print("vertical joystick move to x:\(x) y:\(y) direction:\(direction.rawValue)")

        }

    }

    func joystickViewDidEndMoving(_ joystickView: JoystickView) {

        if joystickView == horizontalJoystick{

            print("horizontal joystick did end moving")

        }else{

            print("vertical joystick did end moving")

        }

    }

}

Example

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

Requirements

iOS9+

Installation

JoystickView is available through CocoaPods. To install

it, simply add the following line to your Podfile:


pod "JoystickView"

Author

CatchZeng, http://catchzeng.com

License

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

相关源码推荐:

我来说两句
*滑动验证:
所有评论(5)
知新1990 2018-11-2 18:30:23
不错不错,楼主辛苦了。。。
回复
这是个逗比 2018-11-2 18:32:11
我是来学习的
回复
kengsir 2018-11-2 18:32:26
帮帮顶顶!!
回复
Yf8546 2018-11-2 18:33:01
感谢分享,code4app有你更精彩
回复
pp美景 2018-11-2 18:35:27
感谢分享,code4app有你更精彩
回复
无限释囚 2018-11-2 18:39:12
写的真的很不错
回复
code4app热心网友 2018-11-2 23:30:16
很给力,Code4App有你更精彩!
回复
code4app热心网友 2018-11-5 10:46:16
强烈支持楼主ing……
回复
嘿,你的益达 2018-11-5 10:46:53
学习学习!
回复
提取码:  下载次数:4 状态:已购或VIP 售价:0(原价:15)金钱 下载权限:初级码农 
466 0 4
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

代码贡献英雄榜
用户名 下载数
通过邮件订阅最新 Code4App 信息
上一条 /4 下一条
联系我们
关闭
合作电话:
13802416937
Email:
435399051@qq.com
商务市场合作/投稿
问题反馈及帮助
联系我们

广告投放| 广东互联网违法和不良信息举报中心|中国互联网举报中心|Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

快速回复 返回顶部 返回列表