/ Published in: Objective C
Creating a vibration is simple as pie - simpler in fact. It just requires one line of code; two if you add the import line. But as simple as a one-liner is it is better to make it into a function. So here is the one liner, followed by the function. Cheers!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// NOTE: You need to import the AudioToolbox for access to the vibrate #import <AudioToolbox/AudioToolbox.h> // The one-liner: AudioServicesPlaySystemSound (kSystemSoundID_Vibrate); // The function: - (void)vibrate { AudioServicesPlaySystemSound (kSystemSoundID_Vibrate); } // The call from within another method in the same class: - (void)myMethod { [self vibrate]; }