Slow down UISnapBehavior

2.2k Views Asked by At

I am using a UISnapBehavior but it is snapping too quickly for my liking. Is there a way to slow it down? Or in other words: is there a way to adjust the elasticity of the object with the point where it should snap to?

2

There are 2 best solutions below

4
On BEST ANSWER

I was able to solve this by attaching the view to a UIDynamicItemBehavior as well and setting the resistance property.

UIDynamicItemBehavior *dynamicItemBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[ view ]];
dynamicItemBehavior.resistance = 100;
[animator addBehavior:dynamicItemBehavior];
2
On

Try setting the behaviour's damping property to a number > 1.0. The header says damping should remain in [0.0, 1.0] however values larger than 1.0 seem to work fine.