我正在开发一个相机应用程序,我想在用户使用相机录制时快速移动设备时发出警告。
所以我想检测设备的移动速度(从左到右)并警告用户设备移动得太快了
ios有什么简单的方法可以检测设备的移动速度吗?
请帮忙
最佳答案
// Use Shake Gesture
override func becomeFirstResponder() -> Bool {
return true
}
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
if motion == .motionShake {
// Your Code or Show Alert
}
}
关于ios - ios录制视频时如何检测设备的移动速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51627020/