1

I have a really strange problem with iOS7 using Storyboards and the ios simulator:

I try to update an older project to iOS7 by setting the iOS 6/7 deltas to adapt to the status bar in Interface builder for a view that I defined in a storyboard. This view is set into a programmatically created UINavigationController as the root view.

When I do that, the iOS7 iPad simulator shows the right UI - my view is shown under the navigation bar - however, when I run exactly the same code on a real iOS7 iPad, it shows the view 20 pixels too low; in fact if I do not change anything at all with the deltas it shows right on the device.

The thing I do not understand here is why the simulator and the device behave differently in this case - did anyone experience this same problem? With my other projects I don't have this problem, so I think it's either the Storyboard or some other setting that leads to this strange behaviour.

UPDATE:

Interestingly after I installed everything anew on a new MacBook the problem is gone (may also have been the newest Xcode update ...).

TheEye
  • 9,280
  • 2
  • 42
  • 58
  • How do you set the iOS6/7 delta on your view ? – Jordan Montel Oct 09 '13 at 08:54
  • IB "View as iOS7 or later", iOS6/7 deltas deltaY "-20", and the view content adapted to 20 pixels lower. Thing is, if I don't set the delta it shows wrong in the simulator, but right on the device. I do understand there can be a lot wrong with setting the deltas and working with UINavigationController etc., but at least the simulator should show the same UI as the device ... – TheEye Oct 09 '13 at 09:00
  • Have a look to my answer maybe it will help you : http://stackoverflow.com/questions/19226751/ios7-iphone-5-giving-white-space-at-the-top/19227039#19227039 – Jordan Montel Oct 09 '13 at 09:05
  • not just in this case... the simulator and a _real_ device behave differently in many other situations as well. – holex Apr 04 '14 at 16:23
  • of course that is the case - but this was the only time that the UI was completely out of sync for simulator and device, and only for a specific project, whereas all other projects did not have this problem. This was clearly some internal bug / corrupted setting ... – TheEye Apr 07 '14 at 11:08

1 Answers1

1
    if( [self respondsToSelector:@selector(edgesForExtendedLayout)] ) {
  self.edgesForExtendedLayout = UIRectEdgeNone;
}

I did apply this fix to the viewControllers. In every viewDidLoad of the ViewControllers where this error appears. Also you will have to take out the Delta you set in the xib or Storyboard. The End result of this "fix" will be ... that in simulator and on Device everything looks good and exact as wanted. (at least it does in my case). Let the xib or storyboard view stay as "View as iOS 6.1 and Earlier" than they will also look good and you can still work with them. The only problem with this fix is : if you use the assistant editor and look at the xib or storyboard how it would look under iOS 7, it does not look good ... some views will be of position. Hope it helps.

  • Well. I ended up doing it right for the devices. Next update will drop iOS 6 support anyway I suppose ... – TheEye Jan 16 '14 at 12:35