是否可以在我自己的应用程序中使用现有的Apple系统声音?我想用 Swift 编写一个示例应用程序,执行以下步骤:
- 读取/获取设备上所有可用系统声音的列表(我认为它们位于
/System/Library/Audio/UISounds/
)
- 在屏幕上显示列表
- 如果我触摸列表项,则播放这些声音
所以它基本上是一样的,就像你在 iPhone 上选择新铃声一样。
我认为有些应用程序正在使用这种声音,或者他们复制/购买了它?
您可以使用以下 Swift 5 代码来播放系统声音:
// import this
import AVFoundation
// create a sound ID, in this case its the tweet sound.
let systemSoundID: SystemSoundID = 1016
// to play sound
AudioServicesPlaySystemSound(systemSoundID)
我能找到的最新声音列表是here https://github.com/TUNER88/iOSSystemSoundsLibrary.
文档参考 https://developer.apple.com/library/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/#//apple_ref/c/func/AudioServicesPlaySystemSound
这就是它们听起来的样子:https://www.youtube.com/watch?v=TjmkmIsUEbA https://www.youtube.com/watch?v=TjmkmIsUEbA
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)