make a button play sound without lag
Im making a button play sound, like开发者_Python百科 a button sound effect for example in jely car 3 when you press like a new game button it would have a sound effect like "boop." I have done that but there is heaps of lag on the ios simulator which means there will be more on the iphone HELP TKS!
Inside ViewDidLoad
AVAudioPlayer *pp1 = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"bomb" ofType:@"wav"]] error:nil];
    self.playerBG = pp1;
    [pp1 prepareToPlay];
      [pp1 release];
use the below code to play sound where you want
[playerBG play];
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论