vibration

How to make iPhone vibrate using Swift?

 ̄綄美尐妖づ 提交于 2019-11-26 11:47:47
问题 I need to make the iPhone vibrate, but I don\'t know how to do that in Swift. I know that in Objective-C, you just write: import AudioToolbox AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); But that is not working for me. 回答1: Short example: import UIKit import AudioToolbox class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) } } load onto your phone and it will vibrate. You can put

Are there APIs for custom vibrations in iOS?

北慕城南 提交于 2019-11-26 11:33:31
Starting in iOS 5, users are able to create custom vibration patterns for alerts and rings. The following screenshot shows the UI for creating one (Contacts app in iOS 6): I've been searching around, including the documentation, and I cannot find any public APIs that expose the creation or playback of custom vibrations. The closest thing is to use the AudioToolbox framework to play a short, constant vibration: AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); Does anyone know if there are APIs for custom vibrations? It doesn't necessarily have to be public APIs. I'm curious to know what

Making the iPhone vibrate

≯℡__Kan透↙ 提交于 2019-11-26 03:24:56
问题 How can the iPhone be set to vibrate once? For example, when a player loses a life or the game is over, the iPhone should vibrate. 回答1: From "iPhone Tutorial: Better way to check capabilities of iOS devices": There are two seemingly similar functions that take a parameter kSystemSoundID_Vibrate : 1) AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); 2) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); Both of the functions vibrate the iPhone. But, when you use the first function on

Are there APIs for custom vibrations in iOS?

醉酒当歌 提交于 2019-11-26 02:27:45
问题 Starting in iOS 5, users are able to create custom vibration patterns for alerts and rings. The following screenshot shows the UI for creating one (Contacts app in iOS 6): I\'ve been searching around, including the documentation, and I cannot find any public APIs that expose the creation or playback of custom vibrations. The closest thing is to use the AudioToolbox framework to play a short, constant vibration: AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); Does anyone know if there