-1
有沒有使用系統的聲音,如蘋果的計算器應用程序的方式iOS版:增加系統聲音按鈕,迅速
@IBAction func button(_ sender: UIButton) {
}
幫助表示讚賞
相信有一些不同的僅僅是用系統的聲音 張貼的問題是專注於使用url聲音
有沒有使用系統的聲音,如蘋果的計算器應用程序的方式iOS版:增加系統聲音按鈕,迅速
@IBAction func button(_ sender: UIButton) {
}
幫助表示讚賞
相信有一些不同的僅僅是用系統的聲音 張貼的問題是專注於使用url聲音
您可以使用AudioToolbox框架。用法示例(使設備振動):
import AudioToolbox.AudioServices
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
完整的文檔:https://developer.apple.com/documentation/audiotoolbox
要嘗試另一個常量,看到這一點:https://developer.apple.com/documentation/audiotoolbox/system_sound_services/1618202-alert_sound_identifiers
或只是命令+點擊不變kSystemSoundID_Vibrate
看其他常量。
謝謝....你能給我另一個例子不振動,但播放系統聲音...我與SystemSoundID – jin
看到我的編輯。基本上,'kSystemSoundID_Vibrate'只是一個常量。 – Glenn
但僅適用於iPhone的kSystemSoundID_Vibrate。 – jin