Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
kennedy otis
3,570 PointsUIView
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
42,016 Pointsmaybe try adding it as a subview of your tabBar.
kennedy otis
3,570 PointsAm not using tababr..just some uiview controller
Stone Preston
42,016 Pointsare you using a navigation controller to navigate between views?
kennedy otis
3,570 PointsYes.
Stone Preston
42,016 Pointsmaybe you could add it as a subview of that then.
kennedy otis
3,570 PointsThis 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?