Center multiple views with varying height using autolayout

你离开我真会死。 提交于 2019-12-13 04:47:35

问题


This answer: https://stackoverflow.com/a/25898949/1364053 is suitable for my problem to some extent. What I need is there are three views in my container view.

The middle one is a scroll view. If I pin height and width of all three views and use the ratio method as described in the above link, all works fine.

But I need the middle scrollview to grow to some extent, let's say the current height of the scroll view is 30, If the device height is increased it should grow to a max of 40 but not more than that (<= constraint).

Ok..So I tried giving two constraints to the middle view. The <= constraint has higher priorty (750) than the = constraint (250).. but when the screen size is increased.. the height stays the same.


回答1:


Sample.xib The uploaded xib might help you.



来源:https://stackoverflow.com/questions/30283815/center-multiple-views-with-varying-height-using-autolayout

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