While using my application, the user should be able to start, stop, forward background music. (Via several UIViewControllers). For this, I made MusicPlayer a singleton ( NSObject
). If I create controls in each view for myself, it works, but I want basically one view that processes the music player class and is present all the time . The user should also be able to "hide" and "show" the view by swiping it left or right. Therefore, if it is hidden, and I change my view controller, it must be hidden in the new view controller, and the music should not be interrupted.
I tried this 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 ApplicationDelegate?
source share