UIRotationGestureRecognizer 作为音量旋钮
我为 iPhone 制作了一个远程应用程序,现在想为其添加一些手势。我想要的手势之一是改变音量的旋转手势。
我的问题是:如何将 UIRotationGestureRecognizer 提供的旋转和速度“转换”为百分比音量?
我需要将绝对值传递给我远程控制的系统(例如 1% 或 50% 或 100%),并且我知道手势开始时设置的值。但我该如何决定旋转何时足以增加或减少 1% 的音量呢?
这让我很头疼,所以任何帮助将不胜感激。谢谢!
I made a remote app for iPhone and now want to add some gestures to it. One of the gestures I would like is a rotation gesture to change volume.
My problem is: How can I "translate" rotation and velocity that are delivered by the UIRotationGestureRecognizer to percent volume?
I need to pass an absolute value to the system I remote control (like 1% or 50% or 100%) and I know the value set when the gesture starts. But how would I decide when rotation was far enough to increase or decrease the volume by 1%?
This makes a big knot in my head, so any help would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常用户可以旋转手的最大角度是 180°,所以我认为 1% 是
180° / 100 = 1.8°
Usually the most a user can rotate his hand is 180˚, so i think it would make sense that 1% would be
180˚ / 100 = 1.8˚