views:

131

answers:

1

Hi,

My application consists of a table view. When a cell is touched the navigation controller moves to a tab bar controller and the "root" view of the tab bar controller has a button that plays an mp3.

My question is this. When a user clicks the back button to go back to the table view and there is currently audio playing, how do I stop the audio playing?

First off I tried calling [audio stop] in the delloc and viewdidunload functions of the view where the audio object lives (the "root" of my tab bar controller). I put break points in these functions and they don't even get called.

A: 

Try one of these :) They are both part of the UIViewController class.

- (void)viewWillDisappear:(BOOL)animated

- (void)viewDidDisappear:(BOOL)animated
willcodejavaforfood
hmmmm.... Neither of those worked and my breakpoints didn't stop in them either?Maybe I'm calling it in the wrong file? To clarify I haveA DetailViewTabbarControllerThis has 4 tab subviews, tab1,tab2,tab3,tab4My audio is playing in tab1 and its in this UIView that I have put the functions to stop the audio.
dubbeat
Do you by UIView mean that or UIViewController? These methods only make sense in a UIViewController.
willcodejavaforfood
dubbeat
That is very strange. I almost don't believe you :) You really should not have to do that but you can of course. You would have to declare the audioPlayer as a property to access it from outside the class. If I was you I would try and get the methods we talked about earlier to work as it is weird that they dont.
willcodejavaforfood
Ok thanks. Yeah it is weird alright. I must of done something dumb that I can't spot. The files are quite small at this time so I might just delete them and start from scratch with a bit more care
dubbeat
Hey did you have a look at the apple dev guide for TabController programming? I thought they were pretty good, even though the one in Beginning iPhone Programming was better.
willcodejavaforfood
hmmm, I'll check it out. I had been working from a apress book but I guess getting the more angles the better! :)Thanks for the tip
dubbeat