iOS 10 中新的键盘敲击声的系统声音 ID 是什么?
What are the system sound ids for the new keyboard clicks in iOS 10?
一般
我正在开发第三方键盘,目前正在尝试模仿 Apple 在 iOS 10b4 中引入的新键盘点击。
现状
可以使用AudioServicesPlaySystemSound(1104)
播放常规的点击声音,但我似乎找不到其他两个新声音的系统声音 ID。我找到了他们的 .caf
等价物的位置,但是即使在使用 AVAudioPlayer
.
调整音量后,这些声音太大而无法使用
问题
是否可以获取新点击声音的系统声音 ID?
额外
如果有人想要个人使用的 .caf
文件路径,它们是:
/System/Library/Audio/UISounds/key_press_click.caf
/System/Library/Audio/UISounds/key_press_delete.caf
/System/Library/Audio/UISounds/key_press_modifier.caf
iOS 10.0 - iOS 11.0 b5
点击 - ID:1123
按删除 - ID:1155
新闻修改器 - ID:1156
评论 (1):相同的 ID 适用于 iOS 11 beta 5
在 swift 中使用枚举实现(使用您自己的其他系统声音 ID 扩展):
import AudioToolbox
enum SystemSound: UInt32 {
case pressClick = 1123
case pressDelete = 1155
case pressModifier = 1156
func play() {
AudioServicesPlaySystemSound(self.rawValue)
}
}
并像这样使用:
@IBAction func pressedDigit(sender : UIButton) {
SystemSound.pressClick.play()
}
一般
我正在开发第三方键盘,目前正在尝试模仿 Apple 在 iOS 10b4 中引入的新键盘点击。
现状
可以使用AudioServicesPlaySystemSound(1104)
播放常规的点击声音,但我似乎找不到其他两个新声音的系统声音 ID。我找到了他们的 .caf
等价物的位置,但是即使在使用 AVAudioPlayer
.
调整音量后,这些声音太大而无法使用
问题
是否可以获取新点击声音的系统声音 ID?
额外
如果有人想要个人使用的 .caf
文件路径,它们是:
/System/Library/Audio/UISounds/key_press_click.caf
/System/Library/Audio/UISounds/key_press_delete.caf
/System/Library/Audio/UISounds/key_press_modifier.caf
iOS 10.0 - iOS 11.0 b5
点击 - ID:1123
按删除 - ID:1155
新闻修改器 - ID:1156
评论 (1):相同的 ID 适用于 iOS 11 beta 5
在 swift 中使用枚举实现(使用您自己的其他系统声音 ID 扩展):
import AudioToolbox
enum SystemSound: UInt32 {
case pressClick = 1123
case pressDelete = 1155
case pressModifier = 1156
func play() {
AudioServicesPlaySystemSound(self.rawValue)
}
}
并像这样使用:
@IBAction func pressedDigit(sender : UIButton) {
SystemSound.pressClick.play()
}