Is it possible to add a UIView on the staus bar of size (320 x 20)? I don't want to hide the status bar, I only want to add it on top of the status bar.
The icons in the status bar at the top of the screen provide information about iPhone. On an iPhone with Face ID, there are additional status icons at the top of Control Center.
To customize it, first pull down the slider bar from the top of the screen. Next, tap on the three vertical dots in the top right corner. Now click on Status bar. You're in.
Just launch Xblast Tools and navigate to Status Bar -> Clock Settings -> Center clock. After a quick reboot, your status bar will be looking very similar to an iPhone's.
You can easily accomplish this by creating your own window above the existing status bar.
Just create a simple subclass of UIWindow
with the following override of initWithFrame:
@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
You can now, for example in a view controller in your application, create an instance of your new class and make it visible.
overlayWindow = [[ACStatusBarOverlayWindow alloc] initWithFrame:CGRectZero]; overlayWindow.hidden = NO;
Be aware of messing with the window key status by using - (void)makeKeyAndVisible
or similar. If you make your main window (the UIWindow
in your Application Delegate) loose key status, you will encounter problems with scrolling scrollviews to top when tapping the status bar etc.
I wrote a static library mimicing Reeders status bar overlay, you can find it here: https://github.com/myell0w/MTStatusBarOverlay
It currently supports iPhone and iPad, default and opaque black status bar styles, rotation, 3 different anymation modes, history-tracking and lots of more goodies!
Feel free to use it or send me a Pull Request to enhance it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With