首页 > 其他 > 详细

摇一摇

时间:2017-02-12 19:47:59      阅读:216      评论:0      收藏:0      [点我收藏+]
// 实现摇一摇的两种方式
// 1、使用加速计获取加速度数据,自定义一个范围,超过该范围就判定为产生摇动事件
// 2、使用系统封装好的摇动事件

import UIKit

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func motionBegan(_ motion: UIEventSubtype, with event: UIEvent?) {
        print("开始摇动")
    }
    
    override func motionCancelled(_ motion: UIEventSubtype, with event: UIEvent?) {
        print("摇动被打断")
    }
    
    override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
        print("摇动结束")
    }
}

 

摇一摇

原文:http://www.cnblogs.com/panda1024/p/6391496.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!