I know it's possible to remove a status bar, however the frame shifts up by the height of the status bar if you set it to hidden. As such, the following code:
[UIApplication sharedApplication].statusBarHidden = YES;
is not sufficient for just hiding the text of the status bar. What I'm ultimately attempting to accomplish here is something similar to the Gmail app in which as the side-menu is displayed, the status bar text is hidden, and then once a selection is made the frame returns to normal with the status bar text displayed.
This question shows how to animate the hiding of the status bar but the result is that the entire window shifts up by the height of the status bar. I'm trying to avoid that from happening.
Objective-C version:
[AppDelegate instance].window.windowLevel = UIWindowLevelStatusBar;
Swift version:
AppDelegate().window!.windowLevel = UIWindowLevelStatusBar
This should do it. It's a bit of a hack, however:
NSString *key = [[NSString alloc] initWithData:[NSData dataWithBytes:(unsigned char []){0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x61, 0x72} length:9] encoding:NSASCIIStringEncoding];
id object = [UIApplication sharedApplication];
UIView *statusBar;
if ([object respondsToSelector:NSSelectorFromString(key)]) {
statusBar = [object valueForKey:key];
}
[UIView animateWithDuration:0.3
animations:^{
statusBar.alpha = 0.0f;
}
];
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