Reputation: 1058
I have a custom UIView XIB file, in which I have placed two buttons:
How can I progammatically (Swift) or using the interface align these buttons to look like this?
Currently, I get this
Following Alexander's method, i did this, this is my current constraints and workspace.
Upvotes: 2
Views: 412
Reputation: 7892
Just Follow this step :
Step 1.select LEFT IMAGE and set these constraint
Step 2 : Select Right Image and set these constraint : - Right - Top - Bottom
Step 3 :Select Left Image and CMD+ Drag mouse from left to right image and select SELECT HORIZONTAL SPACING
Step 4 : Select Left Image and CMD+ Drag mouse from left to right image and select EQUAL WIDTH as image shown in step 3.
Solved !
Hope it helps.
Upvotes: 1
Reputation: 4188
Add such constraints in IB: equal widths
equal heights
pin top of one button to top of other
also for bottom
set left, top, width and height for left bottom
Upvotes: 0
Reputation: 1272
IMAGE1 - https://i.sstatic.net/XJzDv.jpg
IMAGE2 - https://i.sstatic.net/sE2zu.jpg
Upvotes: 0
Reputation: 1568
Add following constraint to Button 1:
For Button 2:
Upvotes: 1