Center Buttons with UIStackview

suggest change

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 .

Distribution -> Fill Equally
     Spacing -> 5 (as per your requirement)

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

center Horizontally in container

center vertically in container
and select Update Frame.

Step 8 :- It’s time for Output for All device .

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


UIStackView:
* Center Buttons with UIStackview

Table Of Contents
12 UIView
15 UIColor
25 UIStackView
26 UIImage
28 CALayer
30 NSDate
40 iBeacon
49 NSTimer
79 NSURL
87 AWS SDK
96 NSData
101 Segues
104 EventKit
105 NSBundle
106 SiriKit
111 StoreKit
117 3D Touch
119 Keychain
122 Block
141 AirDrop
144 UISlider
145 Carthage
146 HealthKit
151 plist
157 MVVM
164 UIPhoenix
166 Simulator
168 NSArray
169 OpenGL
175 Core Data
179 MyLayout
180 UIFont
189 Security
200 Codable