iOS 7 status bar overlapping UI
You can resolve this issue if you are using storyboards, as in this question: iOS 7 - Status bar overlaps the view
If you're not using storyboard, then you can use this code in your AppDelegate.m
in did finishlaunching
:
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}
Also see this question: Status bar and navigation bar issue in IOS7
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
.
how to fix status bar overlap issue in ios 7
-(void)viewWillLayoutSubviews{
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
self.view.clipsToBounds = YES;
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenHeight = 0.0;
if(UIDeviceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
screenHeight = screenRect.size.height;
else
screenHeight = screenRect.size.width;
CGRect screenFrame = CGRectMake(0, 20, self.view.frame.size.width,screenHeight-20);
CGRect viewFr = [self.view convertRect:self.view.frame toView:nil];
if (!CGRectEqualToRect(screenFrame, viewFr))
{
self.view.frame = screenFrame;
self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}
}
}
status bar is overlapping with the view in iOS7
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
iOS 7 status bar overlapping UI - Need solution for Cordova 3.0
If you don't want to hide status bar check this solution
function onDeviceReady() {
if (parseFloat(window.device.version) === 7.0) {
document.body.style.marginTop = "20px";
}
}
document.addEventListener('deviceready', onDeviceReady, false);
OR
Hide the status bar
Open Project in xcode first select checkbox ( hide during application launch ) under status bar style - general project settings in xcode
select projectname-info.plist (Resources section in xcode)
and add key "View controller-based status bar appearance" and value "NO"
Related Topics
Preventing Avcapturevideopreviewlayer from Rotating, But Allow UI Layer to Rotate with Orientation
How to Load Multiple Storyboard Files Depending on iOS Version? (5 and 6)
Swift- Custom Uitableviewcell Delegate to Uiviewcontroller Only One Protocol Works
Getting System Uptime in iOS/Swift
Open Viewcontroller from Tab Like in Instagram Camera Page on iOS
How to Record a Video with Augmented Reality
Creating a Custom Progress Bar with Images
App Running on iPad While Its Iphone-Only
iOS Notification When Application Is Closed
Xcode 7 Beta 6, Dyld _Nsarray0_ Crash
How to Default Uilabel Font and Size Using Swift
Objective C- Trouble Updating UI on Main Thread
A Lighter Way of Discovering Text Writing Direction
Will iOS Awake My App When I Receive Silent Push Notification(When App Is Not in Running State)
Allow Full Access Check in Keyboards iOS10
Module Compiled with Swift 5.0.1 Cannot Be Imported by the Swift 5.1 Compiler