点击按钮声音

#import <AudioToolbox/AudioToolbox.h>


static SystemSoundID shake_sound_male_id = 0;


-(void) playSound

{

    NSString *path = [[NSBundle mainBundle] pathForResource:@"shuidi" ofType:@"wav"];

    if (path) {

        //注册声音到系统

        AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path],&shake_sound_male_id);

    }

    

    //    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);   //让手机震动

}

你可能感兴趣的:(按钮点击声音)