I just start to read this ebook, and after reading to chapter 2, I want to implement it to my own project, but ‘something weird’ happens.
so let say I have a button. and I implement autolayout before the running. I make the button horizontally in container. and then I want to animate this button like in the chapter 1.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)theButton.center.x -= view.bounds.width } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) UIView.animate(withDuration: 1, delay: 0, options: [], animations: { self.theButton.center.x += self.view.bounds.width }, completion: nil) }
but it seems that the button start moving from the center to the right side…
if I remove all constraints of the button, it will work as I expect. but how to make animation and also I have autolayout contraint in it?
is it explained in in the book? am I jumping the gun since I just read to chapter 2? Thanks