Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slow down UISnapBehavior

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?

like image 725
drewag Avatar asked Oct 06 '13 22:10

drewag


2 Answers

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];
like image 176
drewag Avatar answered Oct 20 '22 00:10

drewag


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.

like image 32
Rhythmic Fistman Avatar answered Oct 20 '22 00:10

Rhythmic Fistman