I\'m facing an issue. I\'m working on an app and I\'m using storyboard
with Autolayout enabled. Now on one of my UIViewControllers
For all the views that you are animating write the following code in viewDidLoad
myViewToAnimate.translatesAutoresizingMaskIntoConstraints = YES;
Hope this helps
The reason is Autolayout will update the views to their original position. The Autolayout system will periodically set the position and size of every view in your view hierarchy based on the layout constraints.
Add this:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
VIEWTOFIX.setTranslatesAutoresizingMaskIntoConstraints(true)
}
Putting it in viewDidLayoutSubviews
instead of viewDidLoad
got rid of the layout constraint errors for me.