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

后端 未结 8 1948
独厮守ぢ
独厮守ぢ 2020-12-23 15:49

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 th

8条回答
  •  忘掉有多难
    2020-12-23 16:48

    Well, I was facing this issue but I have found a solution. Problem is the Safe Area.

    • Embed Scroll view in a UIview.
    • give Top, Bottom, Right and Left 0.
    • now give constraints of scroll view with this view.
    • Add Equal height and width of content view to this View.

    parent view is automatically giving Safe Area. All you have to do is just embed your scroll view in a UIview and then give equal height and equal width of the content view to this view.

提交回复
热议问题