How can I hide and show the UIStatusBar?

I am trying to detect a hidden and showing iPhone UIStatusBar, but failed. Could some solution help me like KVO or something else?

+4
source share
2 answers

You can observe the statusBarHidden property for a generic instance of UIApplication .

A simple example:

 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { // Do something here... } - (void)viewDidLoad { [super viewDidLoad]; [[UIApplication sharedApplication] addObserver:self forKeyPath:@"statusBarHidden" options:NSKeyValueObservingOptionNew context:NULL]; [[UIApplication sharedApplication] setStatusBarHidden:YES]; // Will notify the observer about the change } 
+4
source

The UIApplication class has the statusBarHidden property ... this status bar is hidden or not ... if it returns YES, the status bar is hidden ... try this.

0
source

Source: https://habr.com/ru/post/1439066/


All Articles