Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Temporarily disable/remove constraints while animating UI elements

I've nicely setup my UI inside a storyboard controller. Running the app, everything looks & works great inside the iPhone 5S simulator. More importantly, all the UI elements that have their own IBOutlet (for animation purposes) to the code behave as programmed: moving as intended when methods animate these UI elements when needed.

However, I added constraints by clicking the controller inside the storyboard --> Editor --> Resolve Auto Layout Issues --> Add Missing Constraints. After that, animations stop working because the constraints are keeping them in place.

Is there some sort of command/code to "pause/stop/remove/disable" the constraints during animation & then add them back, when animations are finished, without having to do add constraints back manually?

like image 395
Krekin Avatar asked Jul 30 '26 09:07

Krekin


1 Answers

The best way to use Animation and Autolayout together is by creating IBOutlet of the UI Elements(UILabel, UIButton etc.).

You can change their constant value according to your animation requirements.

like image 78
Bista Avatar answered Jul 31 '26 23:07

Bista



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!