0
有沒有人可以幫助我將此代碼轉換爲可視格式自動佈局? 我嘗試了幾種方法,但我不能這樣做... 謝謝!轉換爲可視格式的自動佈局
// Constraints
horizontal = [NSLayoutConstraint constraintWithItem:loginView.view
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:CGRectGetWidth(loginView.view.frame)];
vertical = [NSLayoutConstraint constraintWithItem:loginView.view
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:CGRectGetHeight(loginView.view.frame)];
centerX = [NSLayoutConstraint constraintWithItem:loginView.view
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0];
centerY = [NSLayoutConstraint constraintWithItem:loginView.view
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:0.0];
[self.view addConstraints:@[horizontal, vertical, centerX, centerY]];