Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animations going in reverse #33

Closed
alanscarpa opened this issue Mar 20, 2016 · 1 comment
Closed

Animations going in reverse #33

alanscarpa opened this issue Mar 20, 2016 · 1 comment

Comments

@alanscarpa
Copy link
Contributor

I have a label on my xib with auto layout constraints centering it vertically and horizontally. I just want to move my label to the right, like in your example code:

UIView.animateWithDuration(2.0, animations: {
            self.label.layer.position.x = 200.0
        }) 

But when I run this, my label loads on the screen, off to the right and then animates back to the center. It's the opposite of what I would expect.

Is this due to the layout constraints?

@alanscarpa
Copy link
Contributor Author

It was because I was executing this code in viewDidLoad. viewDidAppear works because constraints are set up at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant