我能够使用约束更改设置动画
[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,如上所示.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。