Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

kennedy otis
kennedy otis
3,570 Points

UIView

Hi guys I would like to develop a music application where by the music player is located at the bottom of the parent view controller and when one navigates to another view, the play will always be at the bottom. Same way like tab bar controller works. Does anyone know how this can be achieved? A good example is the like the way spotify player which is always the bottom regardless of which scene the user is. Any help on how to achieve this?

4 Answers

Stone Preston
Stone Preston
42,016 Points

maybe try adding it as a subview of your tabBar.

kennedy otis
kennedy otis
3,570 Points

Am not using tababr..just some uiview controller

Stone Preston
Stone Preston
42,016 Points

are you using a navigation controller to navigate between views?

Stone Preston
Stone Preston
42,016 Points

maybe you could add it as a subview of that then.

kennedy otis
kennedy otis
3,570 Points

This is how my design looks. The main page https://dl.dropboxusercontent.com/u/21316108/main.png So when the app is launched, there will be a random music playing. Then when a user clicks on the music button, this view https://dl.dropboxusercontent.com/u/21316108/musiList.png will be pushed in the navigation controller and the still the music will continue playing. The player below is like a clone of the first player... So I select the a new track, then the reflection affects both the player in the main page and the player under the list of songs.. I have tried so far to use the uiviewcontroller containment approach it does not work.

I have created a AudioPlayerView controller class with the player view, and in my main page i add it at the bottom and same in the my music list view controller.. I was thinking may be that will help me out but no luck. This is how i load the player in the main page and music list page

audioView = [[AudioPlayerView alloc] init];

audioView.view.frame = self.musicView.bounds;

[self.musicView addSubview:audioView.view];
[self addChildViewController:audioView];

Am I in the right direction?