Skip to content

How to use with turning on/off constraints #310

Open
@Mason-And-Muse

Description

@Mason-And-Muse

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions