Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can easily accomplish this by creating your own window above the existing status bar.</p> <p>Just create a simple subclass of <code>UIWindow</code> with the following override of <code>initWithFrame:</code></p> <pre><code>@interface ACStatusBarOverlayWindow : UIWindow { } @end @implementation ACStatusBarOverlayWindow - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { // Place the window on the correct level and position self.windowLevel = UIWindowLevelStatusBar+1.0f; self.frame = [[UIApplication sharedApplication] statusBarFrame]; // Create an image view with an image to make it look like a status bar. UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:self.frame]; backgroundImageView.image = [UIImage imageNamed:@"statusBarBackground.png"]; [self addSubview:backgroundImageView]; [backgroundImageView release]; // TODO: Insert subviews (labels, imageViews, etc...) } return self; } @end </code></pre> <p>You can now, for example in a view controller in your application, create an instance of your new class and make it visible.</p> <pre><code>overlayWindow = [[ACStatusBarOverlayWindow alloc] initWithFrame:CGRectZero]; overlayWindow.hidden = NO; </code></pre> <p>Be aware of messing with the window key status by using <code>- (void)makeKeyAndVisible</code> or similar. If you make your main window (the <code>UIWindow</code> in your Application Delegate) loose key status, you will encounter problems with scrolling scrollviews to top when tapping the status bar etc.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload