系统声音
// MARK: - 系统声音 /*----- 系统声音 ------*/ @IBAction func systemSound() { //建立的SystemSoundID对象 var soundID: SystemSoundID = //获取声音文件地址 var path = NSBundle.mainBundle().pathForResource("SaoMa", ofType: "wav") //地址转换 var baseURL = NSURL(fileURLWithPath: path!) //赋值 AudioServicesCreateSystemSoundID(baseURL , &soundID) //使用AudioServicesPlaySystemSound播放 AudioServicesPlaySystemSound(soundID) } /*----- 系统提醒 ------*/ @IBAction func systemAlert() { //建立的SystemSoundID对象 var soundID: SystemSoundID = //获取声音文件地址 var path = NSBundle.mainBundle().pathForResource("SaoMa", ofType: "wav") //地址转换 var baseURL = NSURL(fileURLWithPath: path!) //赋值 AudioServicesCreateSystemSoundID(baseURL , &soundID) //使用AudioServicesPlayAlertSound播放 AudioServicesPlayAlertSound(soundID) } /*----- 系统震动 ------*/ @IBAction func systemVibration() { //建立的SystemSoundID对象 var soundID = SystemSoundID(kSystemSoundID_Vibrate) //使用AudioServicesPlaySystemSound播放 AudioServicesPlaySystemSound(soundID) }