我能够使用
动画化约束变化[UIView animateWithDuration:0.5
delay:0.5
usingSpringWithDamping:0.7
initialSpringVelocity:0.7
options:0
animations:^{
[self.closeButton layoutIfNeeded];
} completion:NULL];
但我的印象是这也可以使用 Facebook POP 库来完成。任何人都可以指出正确的方向以找出方法吗?
谢谢
最佳答案
在这种情况下,您想为 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"];
要使用的主要属性是 kPOPLayoutConstraintConstant,如上所示。
关于ios - 使用 Facebook pop 动画约束?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25612104/