我能够使用约束更改设置动画
[UIView animateWithDuration:0.5
delay:0.5
usingSpringWithDamping:0.7
initialSpringVelocity:0.7
options:0
animations:^{
[self.closeButton layoutIfNeeded];
} completion:NULL];
Run Code Online (Sandbox Code Playgroud)
但我的印象是,这也可以使用Facebook POP库完成.任何人都可以指出我正确的方向找出如何?
谢谢
dar*_*102 19
在这种情况下,您希望为NSLayoutConstraint设置动画,您可以使用POP执行以下操作,它将为约束设置动画.
constraint // this is an NSLayoutConstraint that is applied to some view
POPSpringAnimation *layoutAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayoutConstraintConstant];
layoutAnimation.springSpeed = 20.0f;
layoutAnimation.springBounciness = 15.0f;
layoutAnimation.toValue = @(value to go too);
[constraint pop_addAnimation:layoutAnimation forKey:@"detailsContainerWidthAnimate"];
Run Code Online (Sandbox Code Playgroud)
要使用的主要属性是kPOPLayoutConstraintConstant,如上所示.
| 归档时间: |
|
| 查看次数: |
2839 次 |
| 最近记录: |