Search code examples
iosiphoneobjective-cuinavigationcontrollerstatusbar

how to hide UIApplication Status bar in both Ios version 6.0 and 7.0


i want to hide status bar hidden in both ios 6.0 and ios 7.0. please can you explain any common method which work in both ios version for ios.

please provide solution :-

thanks.


Solution

  • Update In Plist add these property.

    Status bar is initially hidden = YES
    
    View controller-based status bar appearance = NO
    

    Plist

    Programatically

    - (void)viewDidLoad {
        [super viewDidLoad];
        if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
        {
            [self prefersStatusBarHidden];
            [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
        }
        else
        {
            // iOS 6
            [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
        } }
    
    // add this too
    - (BOOL)prefersStatusBarHidden {
        return YES; }