0

I have developed a app in Xcode 5.1 for iOS 6.1 and above. I designed the View controllers from the top without leaving any margin. When I run this on iOS 6.1, it starts from below the top bar that indicates carrier and battery, but on iOS 7 it overlaps the bar.

I searched and found that full screen was deprecated in iOS 7 onwards. This was the code I found on many blogs that states that adding it to viewDidLoad will make the viewcontroller start from below the bar in IOS 7.0. But this is not working for me.

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }

Do I need to add something more. I want this app for iOS 6.1 and above and also for screen inches 3.5 and 4.

MetalJr
  • 302
  • 4
  • 14
ankit_rck
  • 1,796
  • 2
  • 14
  • 24
  • 1
    Side note - Do not check the system version like that. Instead you should check to see if the method exists: `if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {` – rmaddy Feb 05 '14 at 06:18
  • This can be helpful: http://stackoverflow.com/questions/18775874/ios-7-status-bar-overlaps-the-view – Amar Feb 05 '14 at 06:21

1 Answers1

0

I figured out the solution for this. In main storyboard, select view as IOS 7 and later and add 20 delta to y to your view. So when you run your app in IOS 7 and later, it will automatically add 20 offset to your view.It will have no offset added for IOS 6.1 and earlier.

ankit_rck
  • 1,796
  • 2
  • 14
  • 24