swift - 加速器/摇一摇功能

时间:2022-06-01 14:04:24
import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
super.viewDidLoad()
} override func motionBegan(_ motion: UIEvent.EventSubtype, with event: UIEvent?) { print("摇一摇开始")
} override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
print("摇一摇结束")
} override func motionCancelled(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
print("摇一摇取消")
}
}