I would like to align two views (in this case UIButton
instances) next to each other. I want the first button to be left aligned to its superview, which is easy, but I don't see a way to make the second button aligned next to the first one without referencing the first ones width.
Here's what I'm trying right now:
UIView *superView = ...;
UIButton *buttonOne = [UIButton buttonWithType:UIButtonTypeCustom];
buttonOne.translatesAutoresizingMaskIntoConstraints = NO;
[superView addView:buttonOne];
[buttonOne constrainWidth:@"123" height:HEADER_HEIGHT_STRING];
[buttonOne alignTop:nil leading:nil superView];
UIButton *buttonTwo = [UIButton buttonWithType:UIButtonTypeCustom];
buttonTwo.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:buttonTwo];
[buttonTwo constrainWidth:@"345" height:HEADER_HEIGHT_STRING];
[buttonTwo alignLeadingEdgeWithView:buttonOne predicate:@"123"]
How do I avoid the @"123"
in the last line of the code? I want it to just use the width of buttonOne
.