Search code examples
ios7uikit-dynamicsuidynamicbehavioruisnapbehavior

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?


Solution

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