1

Our app has a uiviewcontroller with three container views, vertically stacked. When I run the app on iPhoneX in the sim there is space above and below the views that does not appear in iPhone 8/7. Here's a side by side comparison of the containers and how they layout on each:

Side by side˙

Reading the Apple docs this morning and doing some Googling it looks like the issue might be the safe areas set up for the top and bottom layout guides in iPhone X. According to Apple this would be a solution:

https://developer.apple.com/documentation/uikit/uiview/positioning_content_relative_to_the_safe_area

Problem is we are not targeting iOS 11 at this time, we need to be compatible with 9 and 10. Has anyone else dealt with optimizing for iPhone X but not targeting 11 yet? Any help would be appreciated.

1 Answers1

0

Yo don't need change target. Just add safe area to VC and set the constraints to it.

enter image description here

New: When yo add the safe area, the safe area appear in View:

enter image description here

Set vertical space from save area to view. If you need help with constraints: https://www.raywenderlich.com/160527/auto-layout-tutorial-ios-11-getting-started

This constraints must see like this:

enter image description here enter image description here

Kevinosaurio
  • 1,952
  • 2
  • 15
  • 18
  • If I uncheck those settings I get some gains, but there's still space between the top container and the top notch, same on the bottom. How do I set the constraints to the safe area? – Steve Suranie Nov 21 '17 at 19:55
  • I have set similar constraints but it didn't work for me. Still getting top and bottom space in iPhone X. – Chintan Shah May 01 '19 at 06:49