Autostart and Facebook Pop

Is there currently a way to use the Facebook Pop framework with auto-layout, or do you need to use springs and struts? I continue to read that this is possible, but I do not know what syntax should be able to animate the restriction from above.

+7
ios uiviewanimation facebook-pop
source share
4 answers

In this case, you want to revive NSLayoutConstraint, you can do the following with POP, and it will animate the constraint. Note that POPSpringAnimation is added to the constraint itself .

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"]; 

The main property to use is kPOPLayoutConstraintConstant, as shown above. Therefore, if you want to do this with automatic layout constraints, you can use this constraint property.

Working with the scale and other properties also works with AutoLayout, so you should have no problem getting POP to work with AutoLayout.

+21
source share

In Swift-3, the code is as follows: 'Suppose self.menuFooterConstant is a UI constraint reference on a storyboard.

  if let anim = POPSpringAnimation(propertyNamed: kPOPLayoutConstraintConstant) { anim.toValue = 142 anim.springSpeed = 20 anim.springBounciness = 15 self.menuFooterConstant.pop_add(anim, forKey: "animationForTrendfooter") } 
+1
source share

You can directly animate the constraints. With POP, just use the property name kPOPLayoutConstraintConstant . Customize your animation and add it to the constraint itself.

If you do not want to add animation to the constraint itself, you should keep in mind the following:

Remember to update your viewing limits as part of your animation.

If you use constraint-based layout rules to control the position of your views, you should remove any constraints that might interfere with the animation, as part of the tweaking of this animation. Limitations affect any changes you make to the position or size of the view. They also influence the relationship between the look and his views on the child. If you animate changes to any of these elements, you can remove the restrictions, make changes, and then apply any new restrictions.

* from Apple Docs

0
source share

The correct way to implement pop animation with autolayout is to initialize translatesAutoresizingMaskIntoConstraints

0
source share

All Articles