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);
}
}
}
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
.
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"
Having issues applying solutions for iOS 7 status bar overlap
try this combined with your proposed solution in viewDidLoad:
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;
Another thing you can try is setting the frame on viewdidappear if this does not work for you.
Good luck and upvote up if this works for you :)
UISearchBar overlaps status bar in iOS
If the navigationBar is visible do the following in ViewDidLoad :
self.edgesForExtendedLayout = UIRectEdgeNone;
If the navigationBar is hidden do the following in ViewDidLoad :
Adjust all the UIView elements by shifting them 20pt
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
Related Topics
Swift - Downcast Nsurlresponse to Nshttpurlresponse in Order to Get Response Code
Firebase API Is Not Sending Push Notifications When Using the API
Keep Bluetooth Sound When Initializing Avaudiosession
Fbsession.Activesession.Isopen Returns No Even Though the User Logged-In
Remove Next/Previous Buttons (Inputaccessoryview) for Custom Keyboard in iOS8 Webview
How to Update Data in Tableview Without the Delay Using Cloudkit When Creating New Records
Native Zlib Inflate/Deflate for Swift3 on iOS
Xcode iOS App Development Code Signing
Delphi Xe4 iOS Can't Connect to Paserver
iOS - Linking Framework Storyboard to Viewcontroller for Use in Main Project
Facebook Registration:The Operation Couldn't Be Completed (Com.Facebook.Sdk Error 2)
How to Fix Status Bar Overlap Issue in iOS 7
iOS Custom Annotation: a View Below the Annotation Pin
Detecting Tap Inside a Bezier Path
Arkit Session Paused and Not Resuming
Set<Nsobject>' Does Not Have a Member Named 'Anyobject." - Xcode 6.3
Swift Put Multiple Iboutlets in an Array
Error: Uitableview Jump to Top with Uitableviewautomaticdimension