iosuser-interfaceios11.2

UI Difference in IOS 11 and Lower versions


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.


Solution

  • 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.