i'm currently making an application and one part has a button and when clicked plays a sound, how do i make it that when the user clicks the button it plays, but if they click it and its half way done playing and they click it again it restarts to audio?
heres the code;
heres the code;
Code:
-(IBAction)pushButton6 {
NSString *path =[[NSBundle mainBundle]
pathForResource:@"Aah" ofType:@"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
Last edited by a moderator: