Center Buttons with UIStackview
Step 1 :- take 4 button in your Storyboard. Button1 , Button2 , Button 3 , Button4
Step 2 :- Give Fixed Height and width to All buttons .
Step 3 :- All 2 - 2 button's pair in 2 stackview.
Step 4 :- Set UIStackview Property for both .
Step 5 :- Add both Stackview in one Stackview
Step 6 :- Set
Distribution = Fill equally Spacing =5 in main stackview (set According to your requirement)
Step 7 :- Now set Constrain to main stackview
Step 8 :- It's time for Output for All device .
Create a horizontal stack view programmatically
Create a vertical stack view programmatically
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0