Scrollable Content Size Ambiguity with empty UIScrollView (XCode 6)
Asked Answered
P

3

7

In my project, I have multiple empty scrollview (layout with AutoLayout) in multiple view controllers. At run time, views will be add to those scrollview base on user and their desirable content. This was fine in XCode 5, IB editor never show any warning.

Recently when I update to XCode 6 to gain access to iOS 8 and new iPhone simulators. I found that all those empty scroll view that used to be ok (no warning in XCode 5) now showing warning of scrollable content size ambiguity. I check my AutoLayout and it seems ok.

Any idea what cause this?

P.S. but every thing seems ok when I run with simulator and device, no layout issue.

Phreno answered 3/10, 2014 at 3:29 Comment(0)
H
0

According what you describe the ambiguity is solved in run time, so when you are designing in IB this constraints don't exists.

If you want to avoid this warning you can set intrinsic size to Placeholder in IB as shown:

enter image description here

Hypnos answered 10/11, 2015 at 1:7 Comment(1)
A decade later, this is now incorrect! See 2022 answer.Propinquity
P
0

For 2022:

It's changed slightly.

Here's the warning:

enter image description here

If you are building the scrollview/stackview in code, you'll get that warning.

Here's exactly how to get rid of the warning:

enter image description here

Tap on the specific scroll view in question. Go to Size Inspector (fifth button of right-hand panel), go to the bottom, tap "Ambiguity" and select "never verify"

Note that the intrinsic size placeholder mechanism is not now relevant to this problem.

Propinquity answered 4/10, 2022 at 18:23 Comment(0)
N
-1

1) Add a UIView inside scrollview.

2) Give constraints Leading,Trailing,Top,Bottom as 0.

3) Add two extra constraints to UIView Align to centre X and Y.

Nunuance answered 4/5, 2016 at 5:27 Comment(1)
The whole point is when that is being done in code.Propinquity

© 2022 - 2024 — McMap. All rights reserved.