0

I'm developing a simple tab bar application for school. It has 3 tabs. One of them plays music in streaming and I would like to stop the music playing when the user changes the tab. Is this possible? and How? Thank you in advance!

2 Answers 2

3

Implement the UITabViewController delegate method:

– tabBarController:didSelectViewController:

And you should be able to do what you want. There's also

– tabBarController:shouldSelectViewController:

if you want to know before the tab changes.

Sign up to request clarification or add additional context in comments.

1 Comment

Do you mean UITabBarController?
2

As Carl says, this is possible. However, if I were to develop such application (and actually, I am), I would use the viewWillDisappear method of my UIViewController (and I am). That way you keep the logic separated between your implementations.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.