0
swiftでconstratintsを追加しようとしています。swiftでテーブルビューのセルに制約を追加する
スクリーンショットでわかるように、青い泡の内側に画像を置く必要があります。あなたはそれがうまく機能している見ることができるように
bubbleImageView.addConstraint(NSLayoutConstraint(item: bubbleImageView, attribute: .Width, relatedBy: .Equal, toItem: photoView, attribute: .Width, multiplier: 1, constant: 50))
:
は、私は幅のために次の行を使用していました。bubbleImageView.addConstraint(NSLayoutConstraint(item: bubbleImageView, attribute: .Height, relatedBy: .Equal, toItem: photoView, attribute: .Height, multiplier: 1, constant: 0))
そして:私は次の行との高さのために似たコードをしようとしています
を(私は中央のxは正しいが、幅の制約は、私は今のところcenterxとcentery制約を追加していない働いている見ていない知っています)結果:
なぜこれが働いていないのですか?画像サイズは150x150に固定されています。どうすればこの問題を解決できますか?