Return to Snippet

Revision: 15118
at June 24, 2009 22:10 by KevinBomberry


Initial Code
//  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];
}

Initial URL

                                

Initial Description
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!

Initial Title
iPhone OS - Vibration - Simple Version

Initial Tags
iphone

Initial Language
Objective C