1 つのスーパービューに 2 つのビューを作成し、ビュー間に制約を追加しました。
_indicatorConstrainWidth = [NSLayoutConstraint constraintWithItem:self.view1 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view2 attribute:NSLayoutAttributeWidth multiplier:1.0f constant:0.0f];
[_indicatorConstrainWidth setPriority:UILayoutPriorityDefaultLow];
_indicatorConstrainHeight = [NSLayoutConstraint constraintWithItem:self.view1 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.view2 attribute:NSLayoutAttributeHeight multiplier:1.0f constant:0.0f];
[_indicatorConstrainHeight setPriority:UILayoutPriorityDefaultLow];
[self addConstraint:_indicatorConstrainWidth];
[self addConstraint:_indicatorConstrainHeight];
マルチプライヤー プロパティをアニメーションで変更したいのですが、マルチプライヤー プロパティを変更する方法がわかりません。(ヘッダー ファイル NSLayoutConstraint.h のプライベート プロパティに _coefficient が見つかりましたが、プライベートです。)
multipler プロパティを変更するにはどうすればよいですか?
私の回避策は、古い制約を削除し、 の値が異なる新しい制約を追加することですmultipler
。