Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toggle ios7 status bar [closed]

I would like to know if there is a way to hide the ios7 status bar temporarily (i.e toggle). I have scoured the internet and I can only find out how to turn it off indefinitely.

The thing being is I have one subview that I use as a full screen and unfortunately the status bar needs to be hidden in order to make the subview look cleaner.

This is the code I have found to hide the status bar.. but i have no idea how to bring it back again after hiding it.

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

any help would be greatly appreciated.

like image 989
HurkNburkS Avatar asked Dec 01 '25 08:12

HurkNburkS


1 Answers

It is actually right in the description of the method in the documentation here

If you change the return value for this method, call the setNeedsStatusBarAppearanceUpdate method.

So just make your prefersStatusBarHidden method return YES or NO conditionally based on whether you want it hidden or not and call setsNeedsStatusBarAppearanceUpdate when you know the result will change.

example:

- (BOOL)prefersStatusBarHidden
{
    if(someViewIsVisible)
        return YES;
    else
        return NO;
}
like image 144
Dima Avatar answered Dec 02 '25 23:12

Dima



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!