Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollable Content Size Ambiguity with empty UIScrollView (XCode 6)

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.

like image 495
Tar_Tw45 Avatar asked Oct 03 '14 03:10

Tar_Tw45


People also ask

Is Stackview scrollable?

Scrolling only happens when the content view inside the scrollview is larger than the scrollview! To elaborate on point 6. If the stack view had no elements but all the constraints are in place, you get "Scroll View Need constraints for Y position or height".

What is content layout guide in UIScrollView?

We will use “Content Layout Guide” to give this info to UIScrollView since “Content Layout Guide” relates to the size of the scrollable content area inside UIScrollView. Pin UITextView into “Content Layout Guide” edges with constant value “0” for each constraints: UITextView pinned to Content Layout Guide.


1 Answers

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

like image 186
Diogo T Avatar answered Nov 09 '22 10:11

Diogo T