如何增加 iPhone 的振动时间
我正在使用以下方法来振动设备
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
,但是这种振动的时间很短,我们可以增加这个时间吗?
I am using following method to vibrate the device
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
But this vibrate for a very shor period of time can we increase this period ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您无法使用官方 API 更改振动持续时间。
您可以在循环中多次调用
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
或使用NSTimer
,但不建议这样做。它会耗尽电池电量,并且设备可能会从桌子上掉下来。顺便说一句,如果苹果认为您没有正确使用振动,他们可能会拒绝您的应用程序。
You cannot change vibration duration with official APIs.
You could call
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
multiple times in a loop or using aNSTimer
, but that is not recommended. It drains battery and the device could fall off the table.By the way, Apple could reject your app if they consider you don't use the vibrate properly.
由于 iOS5 允许自定义振动,我相信可以使用任意振动模式创建虚拟联系人,并以编程方式向该联系人发送 iMessage……虽然很混乱,但应该可以绕过愚蠢的 API 限制。我明白为什么不允许长时间振动,但对于触觉来说,除了标准的 400ms 178Hz 突发之外还有其他东西会非常有帮助。
Since iOS5 allows custom vibrations, I believe that a virtual contact could be created with an arbitrary vibration pattern and an iMessage sent programmatically to that contact...messy but should work to circumvent the foolish API restriction. I can see why long vibrations are not allowed, but for hap tics it would be really helpful to have something besides the standard 400ms burst of 178Hz.
我认为没有办法增加振动时间,因为如果我们将苹果固定为常数,就会浪费电力。
i think there is no way to increase the vibrate time since .it wasting the power if we increase apple fixed as constant .