3

I am developing an application that's working fine in IOS6. But in iOS7, the status bar overlaps with the view.

As an example : IOS7

I need the status bar first, and then my icons and Remove last .So Please give me any idea about how to remove the overlap.

but I need this

enter image description here Please give me any idea about my problem

Community
  • 1
  • 1
Pavan Alapati
  • 317
  • 1
  • 5
  • 17

4 Answers4

5

Xcode has iOS 6/7 Deltas which is specifically made to resolve this issue. You have to moved your views 20 pixels down to look right on iOS 7 and in order to make it iOS 6 compatible, You changed Delta y to -20.

enter image description here

Resize the height of views properly on iOS 6 You had to set Delta height as well as Delta Y.

You can see also this - Fix iOS 7 Status bar overlapping

Santosh Sharma
  • 421
  • 3
  • 14
4
 -(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);
    }
  }
}
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
  • add this code into ur view controller, if u add progrmatically it working fine for u , if u used navigation bar use santhosh dharma code it will be fine for use xib or storybaord – Anbu.Karthik Sep 17 '14 at 06:51
1

Try this code.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);
}
Ganesh Kumar
  • 708
  • 6
  • 25
-1

This is the default behavior for UIViewController on iOS 7. The view will be fullscreen and the status bar will cover the top of the view. If you have navigationBar hidden, then you have to adjust all the UIView elements by shifting 20 points.