UIView with Auto Layout doesn't increase height inside UIScrollView

强颜欢笑 提交于 2019-12-25 09:29:02

问题


What I'm trying to do is have a page similar to following wireframe that all UILabels height should dynamically change based on the text:

I currently have a UIView inside a UIScrollView. The issue is I can't get the UIView resize properly based on the its content, for example when description is long. The sample code can be downloaded from here

If not into the mood for code, here's the constraints and how it's setup:

I tried to use the approach mentioned in this post


回答1:


FINALLY, found the solution to it. Needed to remove any height constraint for UIScrollView and contentView and add a bottom constraint as shown below:

Updated the sample app with this change. Now the sample app works as expected.



来源:https://stackoverflow.com/questions/45395920/uiview-with-auto-layout-doesnt-increase-height-inside-uiscrollview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!