首页 > 技术文章 > iOS开发技巧——Autolayout动画

zeyang 2015-04-17 00:30 原文

 

 

 

使用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

推荐阅读