Hide the status bar on iPhone on a single view? Hide the status bar on iPhone on a single view? ios ios

Hide the status bar on iPhone on a single view?


Try This one It will Run perfectly..

[[UIApplication sharedApplication] setStatusBarHidden:YES];

And in XIB set none option for the status bar.

for iOS 7.

Go to info.plist and add two attributes if not present. set "Status bar is initially hidden" to "YES" and set "UIViewControllerBasedStatusBarAppearance" to "NO". This will hide status bar for your app.


#pragma mark - Hide statusbar-(void)hideStatusBar {#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000    // iOS 7.0 or later    [self setNeedsStatusBarAppearanceUpdate];#else    // less than 7    [[UIApplication sharedApplication] setStatusBarHidden:YES];#endif}- (BOOL)prefersStatusBarHidden {    return YES;}


If there is anyone looking for a solution where the above solution does not work (and there is still an annoying blue 20px gap at the top), try putting this in the viewWillAppear on the implementation file of the view controller that you would like the status bar to be hidden.

self.navigationController.navigationBar.frame = CGRectOffset(self.navigationController.navigationBar.frame, 0.0, -20.0);

That literally took me 12 hours or so to fix, and that was the solution, so now i'm spreading the word in case anyone else has this annoying issue.


matomo