White space when using Container View (different results depend on version of iOS)

I have a strange mistake here. Let me show the steps to reproduce it:

  • New project (application Single View, Swift, Universal). Change the storyboard to work with Compact Regular (all iPhone)
  • Add the view (I painted orange) and the Container to the view controller.
  • Set the restrictions for the view: fixed height (for example, 100) and set the Lead, Trailing and Top to 0 (no margins). Set the restrictions for the container: lower, leading and trailing to 0 (no margins). Set a limit between the view and the container: vertical distance - 0.
  • Go to the container view controller (automatically created). Create a view (I painted blue).
  • Set limits on the presentation: top, lead, trailing and from bottom to 0 (no margins)
  • Run the project on the simulator iPhone 4s 8.3 . Then run it again in the iPhone 4s 7.1 simulator and see the error in the space.

Here is my storyboard:

Container storyboard

Here are some screenshots of the difference between 8.3 and 7.1:

iOS 8.3 - issue doesn't happeniOS 7.1 - issue happens: white space between the top view and container

I doubt: will this error appear on real devices running iOS 7.1?

Ps. 1: unchecking the "Customize scroll" does not solve the problem.

Ps. 2: in this project there is no navigation and table view (I saw a bunch of similar problems that these components use, but this is not so).

+5
source share
1 answer

For each sub-view in the built-in view controller, make sure that the master / trailing restrictions do not apply to the fields for both the first and second elements.

enter image description here

+2
source

All Articles