11

While rebuilding my project with the new Xcode 5 released yesterday, I was disappointed to see my storyboard view controller shaken up.

After many attempts to fix things, I must conclude I'm stuck with one remaining issue: Navigation View Controller makes the navigation bar overlaps with the content of the view. Doing so, the app is ok on a iOS 7 device (no overlapping), but with a iOS 6.1 device, the navbar overlaps.

I ran a sample project from FlatUI to crosscheck the issue, and they have the same issue. Any idea please?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95

5 Answers5

13

You are facing problem because of co-ordinate system, co-ordinate system of iOS 6 & iOS 7 are different iOS 7 Uses by default translucent properties.

Try putting this Code in viewDidLoad

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
{
     self.edgesForExtendedLayout=NO;
}
Krunal
  • 6,440
  • 21
  • 91
  • 155
3

I think this is because of co-ordinate system of iOS 6 & iOS 7

Kindly check following two images.

iOS 6:

enter image description here

iOS 7 :

enter image description here

imDeveloper
  • 804
  • 1
  • 8
  • 16
  • How to solve this problem ? i am also facing same problem, my view gets shifted upwards in iOS 7 – Krunal Sep 13 '13 at 13:30
  • 1
    To solve this problem you manually have to check programmatically if(iOS7) { view.frame = CGRectmake(view.frame.origin.x,view.frame.origin.y,view.frame.size.width,view.frame.size.height + status bar height + anyBaryou have added height); anyBar will replace with following Navigation bar = 44 pts Tab bar = 49 You should add this values in your frame whatever you are using if both then add both the values } – imDeveloper Sep 13 '13 at 13:46
  • I have made design in the `.xib` how should i change frame ? – Krunal Sep 13 '13 at 13:55
  • Probably I guess there is no way of doing this using xib. – imDeveloper Sep 13 '13 at 13:58
1

As I said in the comment: in IB (interface builder), you need to go to the "Attribute Inspector" for the view controller, and look at the "Extend Edges" attribute: simply uncheck the "Under Top Bar" flag and you're done.

Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
0

In interface builder, in the size inspector tab, there is a section called iOS 6/7 Delta where you can fix navigation bar issue or when some control have different size in ios7 than in ios6.

cl3m
  • 170
  • 1
  • 6
0

You have to do two things :-

a. select that particular xib or view in storyboard and see on right pane there is extended edges option unlcik first option. now this would shift your view down perfectly.

b.all the contents inside this view will also get shifted below for that you have to set delta factor -(x pixels) for ios7 and +(pixels) for ios6. For setting 6 and 7 you have to select "view as" option in right pane of xib.

Happy coding