0
これは私のビューの左側にあるUIStackView
です。後に続くスペースを使ってこれを行いました。ラベルがあります。私はそれを私のスタックビューの左側にします。私はラベルの制約を設定する代わりに、それはスタックビューを小さくするラベルを締め、どのように私はこの問題を解決するのですか?スウィフトの制約により、間違った要素の幅が小さくなります
NSLayoutConstraint(item: self.mainView, attribute: .Bottom, relatedBy: .Equal, toItem: stackView, attribute: .Bottom, multiplier: 1.0, constant: 10)
NSLayoutConstraint(item: self.mainView, attribute: .Trailing, relatedBy: .Equal, toItem: stackView, attribute: .Trailing, multiplier: 1.0, constant: 10)
NSLayoutConstraint(item: mainView, attribute: .Bottom, relatedBy: .Equal, toItem: Label, attribute: .Bottom, multiplier: 1.0, constant: 10)
NSLayoutConstraint(item: Label, attribute: .Leading, relatedBy: .Equal, toItem: mainView, attribute: .Leading, multiplier: 1.0, constant: 20)
NSLayoutConstraint(item: Stack, attribute: .Leading, relatedBy: .Equal, toItem: Label, attribute: .Trailing, multiplier: 1.0, constant: 10)
:私はちょうどスタックビューは、ラベル幅にわたって
制約幅の優先順位付けしたい、私はそれが変更される可能性があるため、スタックビューに幅の制約を設定したくない、どこでもどんな答えを見つけることができませんでした