status bar is overlapping with the view How do I set the view below the status bar in iOS7 I'm using XIB not a storyboard
-
2Refer answer here, http://stackoverflow.com/questions/17074365/status-bar-and-navigation-bar-appear-over-my-views-bounds-in-ios-7/18785646#18785646 – Nandha Sep 20 '13 at 06:14
-
possible duplicate of [iOS 7 | Navigation bar / Toolbar buttons very close to status bar](http://stackoverflow.com/questions/18901753/ios-7-navigation-bar-toolbar-buttons-very-close-to-status-bar) – Léo Natan Sep 20 '13 at 09:02
4 Answers
I used following code for solve the problem.
- (void) viewDidLayoutSubviews {
CGRect viewBounds = self.view.bounds;
CGFloat topBarOffset = self.topLayoutGuide.length;
viewBounds.origin.y = topBarOffset * -1;
self.view.bounds = viewBounds;
}

- 3,585
- 2
- 24
- 42
-
I found this the best solution to deal with this problem. Works in portrait and landscape as well as when the statusbar is hidden. – Andreas Kraft Apr 08 '15 at 15:17
In iOS 7.0, UI statusbar is transparent, To accommodate the changes in the app as with the status bar style you can use:
UIStatusBarStyleDefault
for Status bar to be dark while for light content use
UIStatusBarStyleLightContent
If facing trouble with background image of View in app where the image is extending itself behind the status bar. Set the image in nib or programmatically(whichever suits you) explicitly with the dimensions on Image.
For More References on UI Changes refer this Guide by Apple. https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/TransitionGuide.pdf

- 3,347
- 2
- 21
- 32
Try this
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone; // iOS 7 specific
You need add the above in your -(void)viewDidLoad
method.

- 8,065
- 3
- 28
- 45
Try this:
If you want to disable the status bar from plist, try this:
Status bar is initially hidden : YES
View controller-based status bar appearance : NO
this is necessary for iOS 7, works for me. Set these two tags in your info.plist.
Everytime your viewcontroller appears, in viewDidLoad or when image picker controller finishes , use this:
- (void) imagePickerController:(UIImagePickerController *)picker1 didFinishPickingImage: (UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
.
.
.
.
}

- 2,021
- 1
- 20
- 32