iOS 7 - Status bar overlaps the view
Xcode 5 has iOS 6/7 Deltas
which is specifically made to resolve this issue. In the storyboard, I moved my views 20 pixels down to look right on iOS 7 and in order to make it iOS 6 compatible, I changed Delta y
to -20.
Since my storyboard is not using auto-layout, in order to resize the height of views properly on iOS 6 I had to set Delta height
as well as Delta Y
.
If you simply do NOT want any status bar at all, you need to update your plist with this data:To do this, in the plist, add those 2 settings:
<key>UIStatusBarHidden</key><true/><key>UIViewControllerBasedStatusBarAppearance</key><false/>
In iOS 7 you are expected to design your app with an overlaid transparent status bar in mind. See the new iOS 7 Weather app for example.
This is the default behaviour for UIViewController
on iOS 7. The view will be full-screen which means the status bar will cover the top of your view.
If you have a UIViewController
within a UINavigationController
and the navigationBar is visible, you can have the following code in your viewDidLoad
or have a background image for navigationBar do the trick.
self.edgesForExtendedLayout = UIRectEdgeNone;
If you have navigationBar hidden, then you have to adjust all the UIView elements by shifting 20 points. I dont't see any other solution. Use auto layout will help a little bit.
Here is the sample code for detecting the iOS version, if you want to backward compatibility.
NSUInteger DeviceSystemMajorVersion() { static NSUInteger _deviceSystemMajorVersion = -1; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSString *systemVersion = [UIDevice currentDevice].systemVersion; _deviceSystemMajorVersion = [[systemVersion componentsSeparatedByString:@"."][0] intValue]; }); return _deviceSystemMajorVersion;}