NSLayoutAnchor
を使用して乗数を設定するにはどうすればよいですか?することができNSLayoutXAxisAnchor
NSLayoutAnchor - XAnchor/YAnchorの乗数を設定する
hConstraint = [view1.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor constant:0.0f];
のみ一定の値を使用しているとき何の乗数パラメータが利用できるありません
UIView *view1 = [[UIView alloc] init];
view1.translatesAutoresizingMaskIntoConstraints = false;
view1.backgroundColor = [UIColor redColor];
[self.view addSubview:view1];
NSLayoutConstraint *hConstraint = [NSLayoutConstraint constraintWithItem:view1
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1.5 constant:0.0f];
:
たとえばのために、我々は1.5の乗数値でこれを行うためにNSLayoutConstraintを使用することができます指定された。
ここにいるiOSの人はいません!!!! – user7429205
あなたの制約は有効ではありません。 –
@the_dahiya_boy私はコードの一部のみを入れました。乗数はNSLayoutWidthAnchorとNSLayoutHeightAnchorでのみ使用できるので、NSLayoutXAxisAnchorを使用して乗数値を指定する方法を知りたいと思います。 – user7429205