#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topConstraint;
@end
@implementation ViewController
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
// 渐进动画
// 自身控件的状态发生变化叫做渐进动画
// 有顺序的图片按照一定的时间间隔,按照顺序做切换-->序列帧动画
// 渐进动画,它是作用在frame bounds center上的,没有约束的动画
// 如果改变约束想执行动画 需要一个方法
// 使用它父控件调用一个方法
// 就是告诉界面,需要立刻的根据约束刷新界面,改变frame
// 控件能看到的关键依然是因为设置了frame
// 而约束只是一套规则,让系统按照一定的规则去计算frame
// [self.view layoutIfNeeded];
self.topConstraint.constant += 100;
[UIView animateWithDuration:2 animations:^{
[self.view layoutIfNeeded];
}];
}
@end