How to Unload a TabBar View when New TabBar view is loaded?
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, Niki开发者_开发知识库l
This worked for me.
- (void)viewWillDisappear:(BOOL)animated { [self.audioPlayer stop];
}
精彩评论