1

In my application while designing the UI i am facing some UI Issue. The Top contraints I am setting in story board are coming same in IOS 11 but in versions lower to that UI is moving up. Please see the attached image

enter image description here

As you can see image in IOS 10 is above from the one in IOS 11.2. How I can have the same UI in all the versions. Contraints I have added are below:

enter image description here

Any help would be highly appreciated.

Zee
  • 1,865
  • 21
  • 42
Shruti
  • 1,849
  • 1
  • 13
  • 21
  • Please include the constraints you're using. – Tamás Sengel Feb 07 '18 at 11:08
  • Did you enable [SafeAreaLayout](https://stackoverflow.com/questions/44492404/safe-area-of-xcode-9)? – Krunal Feb 07 '18 at 11:15
  • 1
    Yes it is enabled. Whatever UI i have set in storyboard is coming as it is in IOS 11 but there is a lot of difference in ios 10 – Shruti Feb 07 '18 at 11:18
  • I dont get this weird contentInsets, safeArea stuff either.. I cant find a good way to target ios 9 to 11 either as apple keeps changing it – Daij-Djan Feb 07 '18 at 16:03
  • @Daij-Djan same here. Either we have to disable the safe area which is again not the good approach. I need a proper solution for this. – Shruti Feb 08 '18 at 04:22

1 Answers1

0

Adding below line in my view controller solved my problem.

edgesForExtendedLayout = UIRectEdge.init(rawValue: 0)

It appears that in iOS 10 and below my view was going under the navigation bar which made to look that view has shifted up. But it was working all fine in iOS 11. So to avoid view controller to go behind any bars added the above line which solved my problem.

Shruti
  • 1,849
  • 1
  • 13
  • 21