我正在快速编写一个基于精灵套件的应用程序,需要使用振动进行简短的触觉反馈
所以首先我导入了 AudioToolbox 并使用了它
AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))
效果很好,但是振动时间太长,而且没有办法控制这个持续时间。
经过一番搜索后,我在这里读到了曹凯文的回答:
iOS 中有用于自定义振动的 API 吗? https://stackoverflow.com/questions/12966467/are-there-apis-for-custom-vibrations-in-ios
但不幸的是 AudioServicesPlaySystemSoundWithVibration 私有函数仅在 iOS 6 中可用。
那么还有其他可能的方法吗?
您需要 AudioServicesPlaySystemSoundWithVibration API。
但不幸的是它是私有的,您无法发布您的应用程序:(
Check 这篇博文 http://corgitoergosum.net/2013/08/22/fun-with-private-apis/ and 这个答案 https://stackoverflow.com/questions/4724980/making-the-iphone-vibrate
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)