I have this code:
NSString *path = [NSString stringWithFormat:@"%@/%@",
[[NSBundle mainBundle] resourcePath],
@"change.mp3"];
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
change = [[AVAudioPlayer alloc] initWithContentsOfURL:filePath error:nil];
[change prepareToPlay];
I write in this code in viewdidload;
now with a button I start this sound, but if I press the same button, I want to stop this sound and restart the sound; I try this code inside IBAction but it don’t work
[change stop];
[change prepareToPlay];
[change play];
what can I do?
How about this: