问题描述
我的应用包含一个自定义控件,用于复制iOS标准键盘的行为。
My app contains a custom control that copies the behaviour of the iOS standard keyboard.
我可以使用以下代码成功播放系统键盘点击声音:
I can successfully play the system keyboard click sound with this code:
UIDevice.current.playInputClick()
在iOS 9及以下版本中,只有一次点击声,这就是我需要的。在iOS 10上,常规键,退格键和其他特殊键有不同的点击声。
On iOS 9 and below there is only one click sound and this call is all I need. On iOS 10, there are different click sounds for regular keys, for the backspace key and for other special keys.
播放这些额外声音的官方方式是什么?我是否必须使用链接答案中的替代方法? playInputClick()
的文档没有提到任何内容。
What is the official way to play these additional sounds? Do I have to use the alternative way from the linked answer? The documentation for playInputClick()
does not mention anything.
有一个,建议使用 AudioServicesPlaySystemSound
播放新的点击声音。但表示,这些ID可能不会指向未来版本的iOS中的最新系统点击声音。解决方法的另一个问题是,似乎无法检查用户是否在系统设置中启用了键盘点击( )。
There is an answer that suggests to play the new click sounds using AudioServicesPlaySystemSound
. But another answer says that these IDs might not point to the latest system click sounds in a future version of iOS. Another problem with the workaround is that there seems to be no way to check if the user has enabled keyboard clicks in the system settings (link).
推荐答案
下面的网址有助于找到合适的声音:
The url below could help with finding proper sound:https://github.com/TUNER88/iOSSystemSoundsLibrary
按Click - ID:1123
Press Click - ID: 1123
按删除 - ID:1155
Press Delete - ID: 1155
按修改器 - ID:1156
Press Modifier - ID: 1156
这篇关于在iOS 10中使用新键盘点击声音的官方方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!