title: Swift: Changing HeightAnchor Programmatically
body: <p>I am following this video tutorial: <a href="https://www.youtube.com/watch?v=4rNtIeC_dsQ" rel="noreferrer">https://www.youtube.com/watch?v=4rNtIeC_dsQ</a></p>
  
  <p>I am struggling to get the height of the container view to change when I choose a different option in the UI Segment Control</p>
  
  <p><strong>approx around 17:51 in the video</strong></p>
  
  <p>I declared the var like so:</p>
  
  <pre><code>var inputsContainerHeightAnchor: NSLayoutConstraint?
  </code></pre>
  
  <p>for the constraints, I now have:</p>
  
  <pre><code>inputContainerView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
  inputContainerView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
  inputContainerView.widthAnchor.constraint(equalTo: view.widthAnchor, constant: -60).isActive = true
  inputContainerView.heightAnchor.constraint(equalToConstant: 150)
  inputsContainerHeightAnchor?.isActive = true
  </code></pre>
  
  <p>for the segment control I have: </p>
  
  <pre><code>func handleLoginRegisterChange() {
  
      let title = segmentedLoginRegisterControl.titleForSegment(at: segmentedLoginRegisterControl.selectedSegmentIndex)
  
      loginRegisterButton.setTitle(title, for: .normal)
  
      inputsContainerHeightAnchor?.constant = segmentedLoginRegisterControl.selectedSegmentIndex == 0 ? 100 : 150
  
  
  
  }
  </code></pre>
  
  <p>The segment control is set up like so: </p>
  
  <pre><code>lazy var segmentedLoginRegisterControl: UISegmentedControl = {
      let sc = UISegmentedControl(items: ["Login", "Register"])
      sc.tintColor = .white
      sc.selectedSegmentIndex = 1
      sc.translatesAutoresizingMaskIntoConstraints = false
      sc.addTarget(self, action: #selector(handleLoginRegisterChange), for: .valueChanged)
      return sc
  }()
  </code></pre>
  
  <p><strong>I am using Xcode Version 8.1</strong></p>
  
  <p>However when I run this is the simulator, the input controller view is 100. and it does not change when I click any of the segments. </p>
  
  <p>Can someone see anything I have missed?</p>