ios手机摇晃监听

应用:
编辑内容页面摇晃进行撤销

代码:
viewdidload:
UIApplication.shared.applicationSupportsShakeToEdit = true
self.becomeFirstResponder()

function:
override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
self.reloadInfo()
}

推荐阅读更多精彩内容