Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7702335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:12:15+00:00 2026-05-31T23:12:15+00:00

During the use of my app, the user should be able to start, stop,

  • 0

During the use of my app, the user should be able to start, stop, forward background music. (Across several UIViewControllers). For this, I made my MusicPlayer a singleton (NSObject). If I create the controls in every view for itself it works, but what I want is basically one view which handles the music player class and is present all the time. The user also should be able to “hide” and “show” the view by swiping it to the left or to the right. So if it is hidden and I change my view Controller it should be hidden in the new view Controller too and the music should not be interrupted.

I tried this one in my home view controller and it works:

UIView * playerView = [[UIView alloc] initWithFrame:CGRectMake(0, 300, self.view.bounds.size.width, 44)];
playerView.backgroundColor = [UIColor redColor];

[[[[UIApplication sharedApplication] delegate] window] addSubview:playerView];

Is there a way to do this in the ApplicationDelegate?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:12:16+00:00Added an answer on May 31, 2026 at 11:12 pm

    If your singleton MusicPlayer is playing the music, then it should not be interrupted when the view changes. And instead of creating music controls for every view controller, you could add the music controls view as a subview of the window and make sure that it stays on top of everything else.

    Update:
    In your application delegate, you typically have some code to set up the main view (i.e. the applicationDidFinishLaunching method). I assume that you have a primary navigation or tab controller in which you do everything else. So after adding its view to the window, create and add your music player controller view and add it as a subview of the window. It will remain on top as long as you don’t add other views to the window (if you do, you just need to move the music controls back to the top).

    I would use a singleton MusicPlayerController view controller which owns the music player controls view. That way, other view controllers can easily show or hide the controls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to save data obtained during app-run and afterwards use it
I use several custom tools during the build process, mostly code generators for service
During development, I use this to load the latest jQuery: <script src=http://www.google.com/jsapi></script> <script type=text/javascript>
My web app offers personalized recommendations. When a user starting to use it, about
I've been working with MT4 client app during several years, until there, everything is
I was searching how to pass an argument in torrent_info() function during the use
I use the maven-properties-plugin during the initialization phase to read in a bunch of
We use employees' desktops for CPU-intensive simulation during the night. Desktops run Windows -
i have application who use specific process during running and i want to sample
Scenario: I use a simple function to minify and compress JS files during the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.