This code works fine until I exit the view and try to come back into it. If I do this, the stop button no longer works. How do I get it to still work after leaving the view?
-(IBAction)musiconButtonClicked:(id)sender{
NSString *path = [[NSBundle mainBundle] pathForResource:@"NextRevIt" ofType:@"mp3"];
self.audioPlayer = [[AVAudioPlayer alloc ] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[audioPlayer play];
}
-(IBAction)musicoffButtonClicked:(id)sender{
[audioPlayer stop];
}