简体   繁体   中英

How to set constraints to stack views?

I'm trying to achieve this layout using the interface builder在此处输入图片说明

I've already tried to embedded the bottom button inside another stackview, also tried to set it out of the stack view but nothing works as expected what have now is this在此处输入图片说明 And getting this result在此处输入图片说明

Can someone tell me what constraints are missing or what is wrong with my current constraints?

You usually don't need to add too many constraints to the stack view's arranged subviews. Setting the distribution and alignment correctly is the key. The constraints involving Stop Button are either unnecessary or causing the conflict that you see in the console.

To position the stack view, you just need to pin its top, bottom, leading, trailing edges to the safe area. For example:

在此处输入图片说明

Then, set the alignment of all the stack views to "Fill", and the distribution of all the stack views to "Fill Equally".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM