Search code examples
ios7statusbarxcode5

Status bar is not hidden in iOS 7


I add this value to plist: "View controller-based status bar appearance" and set it to "NO". - DONT WORK this method

And this don't work too @property(nonatomic, getter=isStatusBarHidden) BOOL statusBarHidden

Please help I will be grateful for the detailed description of what and where to write.


Solution

  • Set "View controller-based status bar appearance" to NO in your plist, and then add this code:

    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
    

    (You can use whatever UIStatusBarAnimation value you want.)

    Alternatively, you can leave "View controller-based status bar appearance" on, and in your view controllers, add this method:

    - (BOOL) prefersStatusBarHidden {
        return YES;
    }
    

    When you want to change whether the status bar is hidden/shown based on the value of the above method, your view controller can call the setNeedsStatusBarAppearanceUpdate method.