Detect iPhone Volume Button Hold? (iOS 8)

廉价感情. 提交于 2019-12-21 12:22:57

问题


Is there a way to detect if any of the volume buttons on the iPhone are being held?

I know you can detect if one has been pressed, but I specifically need to know if one is being held down.


回答1:


That's not really possible, but you can have an approximation starting a timer every time you get a volume button pressed event, since you'll receive multiple events in succession when the button is hold. If every time you restart the timer, when the button is released the timer will get triggered and you can do whatever you want. 0.5 seconds worked for me.



来源:https://stackoverflow.com/questions/28228243/detect-iphone-volume-button-hold-ios-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!