views:

19

answers:

0

Hi, I am playing an audio file in a viewcontroller inside an UITabBar using AVAudioPlayer. So when user clicks a different tabbar item the music is not stopped. I tried adding stop method in viewwilldisappear. But it's not responding. How can I stop my audio when user clicks a new tab bar item. ente

AVAudioPlayer *audioPlayer;

This is my code in view will disappear

[audioPlayer stop];
[sliderTimer invalidate];
audioPlayer = nil;
self.URL = nil;
self.musicTitle = nil;

Thanks, Nikil