title: Adding button to stack view entirely takes up of parent stack view
body: <p>I have been trying to add buttons to a dynamic vertical stack view, the stack view is in a scroll view that's in a horizontal stack view. Whenever I add a button to the stack view it takes up the entire horizontal stack view, here it is:</p>
  <pre><code>override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view.
          let button = UIButton()
          button.setTitle(&quot;test&quot;, for: .normal)
          button.translatesAutoresizingMaskIntoConstraints = false
          Stack.addArrangedSubview(button)
          Stack.translatesAutoresizingMaskIntoConstraints = false
      }
  </code></pre>
  <p>Entire code:</p>
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
      
      @IBOutlet weak var textView: UITextView!
      @IBOutlet weak var emotionsStack: UIStackView!
      
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view.
          let button = UIButton()
          button.setTitle(&quot;test&quot;, for: .normal)
          button.translatesAutoresizingMaskIntoConstraints = true
          button.frame.size = CGSize(width: emotionsStack.frame.width, height: (emotionsStack.frame.width/10))
          emotionsStack.addArrangedSubview(button)
      }
      override func touchesBegan(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) {
          super.touchesBegan(touches,
                             with: event)
          self.view.endEditing(true)
      }
      }
  
  
  </code></pre>
  <p>EDIT:
  <a href="https://i.stack.imgur.com/Ywj2P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ywj2P.png" alt="explanation" /></a></p>
  <p>What happens is that the stackview takes over the textview (that is in red). This isn't supposed to happen.</p>
  <p><a href="https://i.stack.imgur.com/RdiCR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RdiCR.png" alt="enter image description here" /></a></p>