I would like to replace the UIStatusBar in my app with my own view.
I'm assuming that I need to hide the status bar - is this right?
The problem with hiding the status bar is that the navigation bar moves up to occupy it's original position. How can I add my view and move everything back down 20 px?
Assuming that I don't have to remove the status bar, but instead can just cover it with my view, I then have the problem of the background color. This changes between views, so I would need to mask out the existing status bar text - how do I do this?
Thanks for your help.
Your approach is correct with a little tweak with self.view's frame.
Add below method to your viewController,
-(void)viewWillLayoutSubviews{
[super viewWillLayoutSubviews];
self.view.frame =CGRectMake(0, 20, 320, [UIScreen mainScreen].bounds.size.height);
}
Above method moves your view by 20 pixels down.