title: Make generic view that align subviews properly as added swift
body: <p>I've been struggling to figure this out. In my app, my users can advertise their channels by adding social network addresses to their account. During viewDidLoad() I download user data and determine which social network button should be shown for this respective account. All the different buttons such as Facebook, Instagram, Twitter, Pinterest add website should be side by side, however, if the user does not have entered a specific URL that respective button should not be shown. So I'm looking for a behavior like this:</p>
  
  <p>If only 1 button(fx website button) then the website button should be centered in the view. If the user has two button then the view should distribute the two views side by side around the center. And so forth for the third, fourth and fifth button. I thought I could use a UIStackview, to add the first button and have it centered but the UIStackView stretch a single view and if there are two buttons in my UIStackView the are not aligned around center instead they have lots of spacing. Thanks a lot to anyone who has any idea of how to accomplish this.</p>
  
  <p>I guess a parallel could be drawn to the game Heartstone to anyone who has experienced it or want to get a visual idea of what I am thinking. When a minion is dropped on the board it aligns with minions already there.</p>
  
  <p>Edit* Added picture for visibillity:
  <a href="https://i.stack.imgur.com/vUsXf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vUsXf.png" alt="enter image description here"></a></p>
  
  <p>Trials: 
  I have now followed your advice and set the stackview to the appropriate alignment and distribution, and image aspect fit including the overall constraints. The result is far better but, but the spacing is huge they should hug with little spacing around center and large spacing to the sides see img:</p>
  
  <p>overall constraints:
  <a href="https://i.stack.imgur.com/ZleGm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZleGm.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/CIjUs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CIjUs.png" alt="enter image description here"></a></p>
  
  <p>Kinds regards,</p>