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

How to use with turning on/off constraints #310

Open
imagemason opened this issue Jul 17, 2018 · 0 comments
Open

How to use with turning on/off constraints #310

imagemason opened this issue Jul 17, 2018 · 0 comments

Comments

@imagemason
Copy link

imagemason commented Jul 17, 2018

So I've got some views that I want to move around in response to user interaction. To position them I have multiple constraints with different priorities - I can turn one or more constraints off and since there are still other constraints available the view (or whatever) moves to the new location. So normally I would do something like this:

self.settingsBottomConstraint.isActive = false
UIView.animate(withDuration: 0.5, delay: 0, options: [.curveEaseInOut], animations: {
self.brainView.layoutIfNeeded()
}, completion: nil)

How can I accomplish that using Spring? I've tried everything I can think of - it doesn't animate, just turns off the constraint without animation.

Two no good least weird looking things I've tried that doesn't work (I've tried many more):

self.settingsBottomConstraint.isActive = false
self.brainView.animateNext {
self.brainView.layoutIfNeeded()
}

or

self.brainView.animateNext {
self.settingsBottomConstraint.isActive = false
}

Help?! Surely I'm just doing it wrong?

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