title: View Hierarchy not prepared for constraint
body: <p>I am trying to make a tab system in my app such that when a UIButton is tapped, the view switches and a line moves from the other tab button to under the button that was just pressed, and the same for the other tab button. I am doing this by creating a UIView for the green line and two UIButton's for the tab buttons. Both the Buttons are hooked up to IBActions which remove a constraint that ties it's center.x to the old tab button's center.x and add a constraint that binds it to the new tab's button's center.x. However, the button needs to start aligned to the first tab, and when I try to add that constraint programmatically in viewDidLoad, it crashes with "View Hierarchy not prepared for constraint". I cannot add this initial constraint in IB because I need some way to remove it when the next button is pressed.
  I will be happy to provide code or more details if needed.</p>
  
  <p>Thank you</p>