ConstraintWithVisualFormat で水平および垂直のビジュアル フォーマットを一緒に追加する方法は? 横しかありません。V:|-50-[leftButton] と V:|-50-[rightButton] を追加したいです。どうやってするか?別の NSLayoutConstraint を作成しますか?
- (void)viewDidLoad
{
[super viewDidLoad];
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[leftButton setTitle:@"Left" forState:UIControlStateNormal];
[leftButton setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:leftButton];
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[rightButton setTitle:@"Right" forState:UIControlStateNormal];
[rightButton setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:rightButton];
NSArray *layoutConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-50-[leftButton(>=80)]-50-[rightButton(>=80)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(leftButton, rightButton)];
[self.view addConstraints:layoutConstraints];
}