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?