目前有没有办法使用 Facebook Pop具有自动布局的框架还是必须使用 springs 和 struts?我一直在阅读它是可能的,但我不知道能够为 View 的顶部约束设置动画的语法是什么。
最佳答案
在这种情况下,您想要为 NSLayoutConstraint 设置动画,您可以使用 POP 执行以下操作,它将为约束设置动画。 请注意,POPSpringAnimation 被添加到约束本身。
NSLayoutConstraint *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,如上所示。因此,如果您想在自动布局约束上执行此操作,您可以使用此约束属性。
使用比例和其他属性也适用于 AutoLayout,因此您应该没有问题让 POP 与 AutoLayout 一起工作。
关于ios - 自动布局和 Facebook Pop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25068214/