iOS Autolayout: two buttons of equal width, side by side
Solution 1:
Add the following constraints
- Assign equal width from button1 to button2.
- Assign horizontal spacing between both buttons.
- Assign leading space from button1 to its superview.
- Assign trailing space from button2 to its superview.
- Assign top space to both the buttons.
Let me know if it works for you.
Solution 2:
Follow Steps and Screenshots for easy solution
Step-1)
- For Button 1 : Set Constraints: (1)Leading, (2)Top or Bottom asper your need, (3)Height
Step-2)
- For Button 2 : Set Constraints: (1)Trailing,(2)Top or Bottom asper your need, (3)Height
Step-3)
- Press Ctrl + Drag From Button 1 to Button 2
- Select Horizontal Spacing
Step-4)
- Select Both Button (using Command) and Add Constraints Equal Width
OUTPUT
Hope it Helps you :)