用 NSLayoutConstraint实现 Autolayout约束动画化.
首先把约束关联到代码中.
//例如
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *blueViewConstraint;
动画效果
[UIView animateWithDuration:0.3 animations:^{
//constant
self.blueViewConstraint.constant = 10.0;
//优先级
self.blueViewConstraint.priority = UILayoutPriorityDefaultHigh-1;
//refresh layout
[self.view layoutIfNeeded];
}];
通过修改约束的constant或者priority来实现界面的变化.再通过animatel来实现动画.