Sep 07, 2015
: ~ 1 min read

If you want to animate the hidden property of a view, or animate the title of a button, the solution is simple - use UIView.transitionWithView(button [...]. If you want to animate the title of several buttons, the solution is just as simple - use UIView.transitionWithView(containerView [...].

The problem arises when you want to animate constraint changes at the same time: they won't be animated anymore, no matter if you encapsulate them in the same transitionWithView call, a new one, or inside an animateWithDuration call.

The only solution I found is to do a transitionWithView call for each button that needs its title changed, and animate the constraints as usual, inside an animateWithDuration call.

These kind of changes can also be animated with a CABasicAnimation / CATransition, and adding that animation to the view's layer, but in case you need transitionWithView, or don't know why your constraints aren't animating, this might be the reason.