使用了Autolaout的视图的动画
方法一:简单的说就是先找到想要变化的NSLayoutConstraint
然后改变constant值
NSLayoutConstraint * _bottomCelectVLocRight;
_bottomCelectVLocRight.constant = 0;
[UIView animateWithDuration:.5 animations:^{
[self.view layoutIfNeeded];
}];
方法二:把你想要做动画的view的translatesAutoresizingMaskIntoconstraints为yes [UIView animateWithDuration:.5 animations:^{
_bottomCoolectView.translatesAutoresizingMaskIntoConstraints = YES;
_bottomCoolectView.frame = CGRectMake(CGRectGetMinX(_bottomCoolectView.frame)-bottomCoolectViewWidth, CGRectGetMinY(_bottomCoolectView.frame), CGRectGetWidth(_bottomCoolectView.frame), CGRectGetHeight(_bottomCoolectView.frame));
}];
本文介绍了如何使用Autolayout进行视图动画制作。通过两种方法调整约束条件来实现动画效果,一种是直接修改约束常量,另一种是通过改变视图属性实现。这两种方法都提供了平滑的过渡效果。
3314

被折叠的 条评论
为什么被折叠?



