检测iPhone音量按钮保持? (iOS 8) [英] Detect iPhone Volume Button Hold? (iOS 8)
本文介绍了检测iPhone音量按钮保持? (iOS 8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法检测iPhone上是否有任何音量按钮?
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.
推荐答案
这不是确实可能,但是每次按下音量按钮事件时,你都可以有一个近似值启动计时器,因为当按钮被按住时你会连续收到多个事件。如果每次重新启动计时器,当释放按钮时,计时器将被触发,您可以执行任何操作。 0.5秒为我工作。
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.
这篇关于检测iPhone音量按钮保持? (iOS 8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文