3

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?

Krekin
  • 1,516
  • 1
  • 13
  • 24

2 Answers2

1

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.

Bista
  • 7,869
  • 3
  • 27
  • 55
-1

If you're using Autolayout, you should not be trying to move views by changing their frames. You should be animating changes to the constraints, instead.

See this StackOverflow answer for hints:

How do I animate constraint changes?

Community
  • 1
  • 1
Mark Bessey
  • 19,598
  • 4
  • 47
  • 69
  • Alright. So disabling constraints is not possible. If animation can now only occur from manipulating the actual constraints then that requires a new approach to animating. Thanks for the link: that should get me started. – Krekin Sep 16 '16 at 08:21