简体   繁体   English

自动布局-StackView删除现有约束

[英]Auto-layout - StackView deleting existing constraints

I'm hardly learning to implement some iOS app screens in xCode Interface Builder with auto-layout. 我几乎不了解如何使用自动布局在xCode Interface Builder中实现一些iOS应用程序屏幕。

I've already placed some elements with working constraints but I realize it would be more practical to group them into a vertical StackView . 我已经放置了一些具有工作约束的元素,但是我意识到将它们分组为垂直StackView会更实际。

At first it seems pretty easy as I did it for a previous screen. 最初,这看起来很简单,就像我在上一个屏幕中所做的一样。 However, once I embed my elements in the StackView, all my margins constraints are gone ! 但是,一旦将元素嵌入StackView中,我所有的边距约束都消失了! Also, if I try to manually put back my constraints, they don't work at all and generate ambiguity. 另外,如果我尝试手动放回约束,它们将完全无效并产生歧义。

I don't fully understand the way iOS UI builder works, so I'd gladly need some help. 我不完全了解iOS UI构建器的工作方式,因此很高兴需要一些帮助。

See screenshots below. 请参见下面的屏幕截图。

工作限制

所有的约束都消失了!

Constraints inside stack views can be quirky, but playing around with / experimenting with the characteristics can help. 堆栈视图中的约束可能很古怪,但是尝试/试验特性可以有所帮助。

In particular, adjusting Alignment , Distribution , and Spacing can often do the trick. 特别是,调整AlignmentDistributionSpacing通常可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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