Auto height does not work in uiView in swift 3

痴心易碎 提交于 2020-01-03 00:41:27

问题


I would like to adjust the height according to its content.

Currently, I add "Height" in each UIView. These three UIViews are embedded in scrollview.
I would like to set the height of "Red" color uiview into "Auto" . If I set that view into auto height and set the top, right,bottom,left specifically, I got error of "Scroll View".

So, I fix and add missing constraint, then Xcode will automatically define the height of Red UIView.

Let me explain, what I'm doing right now is that I add Segmented Control inside that Red UIView. Under that segmented control, there will be 3 Container Views.
So, I set "Yellow" UIView to cover all these three container views.

So, Under "Yellow" container view, there will be...
- 1 Container View together with collection view.
- 2 Container View together with collection view.
- 3 Container View together with collection view.
(I put collection views in each container views. So, there will be 3 collection view. I overlap these three container views)
I would like to extend the height of Red container according to the collection view content count. If collection view cell is more than 6 cells, then there will be three rows (each row has two collection cell).
I have no idea of how to do this.
Can anyone help me please to solve this problem?

来源:https://stackoverflow.com/questions/45690065/auto-height-does-not-work-in-uiview-in-swift-3

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