How to fix "Scrollable Content Size Ambiguity" in Xcode 11 (iOS 12, iOS 13) using Auto Layout

Pranav Ramesh picture Pranav Ramesh · Jun 12, 2019 · Viewed 24k times · Source

When using Auto Layout, I am unable to set up a simple UIScrollView in my view controller in Xcode 11 beta. I know that I must constrain the scroll view to the edges, and then set the scroll view width and height equal to the width and height of the entire view that contains the scroll view. However, I am not getting the option to set equal widths and heights when I attempt to do so.

When I do the right-click-drag from the scroll view to the entire main view, I get the following options:

  • Leading Space to Safe Area
  • Top Space to Safe Area
  • Trailing Space to Safe Area
  • Bottom Space to Safe Area
  • Center Horizontally in Safe Area
  • Center Vertically in Safe Area

In other videos, there is an "Equal Widths" and "Equal Heights" option that I don't seem to have.

Am I doing something wrong, or did Apple change the way scroll views work in Xcode 11?

Answer

Juan David Torres picture Juan David Torres · Sep 25, 2019

Disabling the content layout guides in size inspector (ruler icon) in properties

Disabling the content layout guides in properties

I was having the same issue, and by disabling the option it was gone.

Hope it helps! :)