iOS开发技巧——Autolayout动画

使用Autolayout时需要在动画的代码前面后面添加

layoutIfNeeded方法

Animation

AutoLayout也可以配合传统的animation方法,整体代码结构如下。

   1:  [self.view layoutIfNeeded]; 
   2:  [UIView animateWithDuration:0.3f 
   3:                   animations:^{ 
   4:                      //... update constraints    
   5:                     [self.view layoutIfNeeded]; 
   6:                   }]; 

x

原文地址:https://www.cnblogs.com/zeyang/p/4433751.html