Official way to use the new keyboard click sounds in iOS 10

夙愿已清 提交于 2019-12-04 08:34:02

问题


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()

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.

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.

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).


回答1:


The url below could help with finding proper sound: https://github.com/TUNER88/iOSSystemSoundsLibrary

As of October 2019, these are the sound IDs

Press Click - ID: 1104

Press Delete - ID: 1155

Press Modifier - ID: 1156



来源:https://stackoverflow.com/questions/39670466/official-way-to-use-the-new-keyboard-click-sounds-in-ios-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!