开发者

Problem with "Click Sound" on button click in iPhone

i am working in the project in which i face the problem of playing the clicking sound on button click, i have done the following code on TouchDown Event of Buttons on every page

-(IBActi开发者_Go百科on)ClickButtonSound:(id)sender
 {
     SystemSoundID theSound;
     NSString *pathToSound;
     pathToSound = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"buttonsound" ofType:@"wav"] isDirectory:NO];
     OSStatus error = AudioServicesCreateSystemSoundID((CFURLRef)pathToSound,&theSound);
     NSLog(@"error=%@",error);
      AudioServicesPlaySystemSound (theSound);
     //[pathToSound release];

 }

this code is working well on simulator but when i test it on iphone device it gives humming sound,but not plays clicking sound so can anyone plese point out the reason why it is so? thanks


Are you sure you stop the sound from playing when you get the TouchUpEvent?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜