IOS development-hide the status bar (battery bar) and ios Status Bar
There are two scenarios:
1. To hide the status bar of A view, for example, when interface A is pushed to interface B, interface A originally displays the status bar. However, interface B does not display the status bar.
At this time, you can do this:
Implement in B:
-(Void) viewDidLoad {[super viewDidLoad]; if ([self respondsToSelector: @ selector (listener)]) {// iOS 7 [self prefersStatusBarHidden]; [self callback mselector: @ selector (setNeedsStatusBarAppearanceUpdate)] ;}}-(BOOL) prefersStatusBarHidden {return YES; // hide as YES and display as NO}
In addition, add the following in the plist file:
Set key: View controller-based status bar appearance to YES
2. This is relatively simple. All views directly hide the status bar. It is also relatively simple.
(Set in plist ):
First, set key: Status bar is initially hidden to YES.
Then set key: View controller-based status bar appearance to NO
You can hide the status bar globally.
How to change the status bar color in ios?
Change the status bar color?
If ([[UIDevice currentDevice] systemVersion] doubleValue]> = 7.0 )){
[Self. navigationBar setBarTintColor: [UIColor redColor];
[Self. navigationBar setTranslucent: NO];
}
Let's try this. It's a color with NavigationBar.
On ios 7, how does one set the status bar to black and white?
Add:
# Define IOS7_OR_LATER (
[[[UIDevice currentDevice] systemVersion] compare: @ "7.0"]! = NSOrderedAscending
)
# If _ IPHONE_ OS _VERSION_MAX_ALLOWED >=70000
If (
IOS7_OR_LATER)
{
Self. edgesForExtendedLayout =
UIRectEdgeNone;
Self. extendedLayoutIncludesOpaqueBars =
NO;
Self. modalPresentationCapturesStatusBarAppearance =
NO;
}
# Endif // # if _ IPHONE_ OS _VERSION_MAX_ALLOWED> =
70000