I have a UIView that I would like to animate off the screen and then bring another view into the screen. I'm using auto layout and I have a IBOutlet set up for the left and right NSLayoutConstraint. Its seem that with out a width set for the UIView that the view actually doesn't animate off the screen.
I'm trying to use this code to pus the UIView off:
self.gameViewConstraintLeft.constant = -400
UIView.animateWithDuration(1, animations: { () in
self.view.layoutIfNeeded()
})
self.gameViewConstriantRight.constant = -400
UIView.animateWithDuration(1, animations: { () in
self.view.layoutIfNeeded()
})
I have constraints set up on the top(0), left(0) and right(0). Maybe this is my issue that I'm pinning the view to the edge of the screen, but I want this to work on multiple screen sizes, so I'm just not sure the best method of achieving my goal.