问题
I would like to adjust the height according to its content.
Currently, I add "Height" in each UIView
. These three UIView
s 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