ios - 自动布局和 Facebook Pop

标签 ios uiviewanimation facebook-pop

目前有没有办法使用 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/

相关文章:

ios - Swift 无法将表达式的类型 '()' 转换为 CGRect 类型

ios - 如何禁用 UITableViewCell 自定义动画?

ios - 手动添加另一个框架所需的框架时出错

ios - 应用程序在后台时不调用远程通知

ios - CGAffineTransform 影响我的 UIView 的角半径

ios - 如何制作 POPAnimation 循环

ios - 反向滑动 UIButton 数组

ios - 如何为开发设置推送通知?

javascript - 在 UIWebView 上加载 javascript