开发者

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];

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜