You want to “flick” your views from one point to another.
Initialize a behavior object of type
UIPushBehavior using its
initWithItems:mode: method, and for the mode,
pass the value of
UIPushBehaviorModeContinuous. Once you are ready to start pushing the items toward an angle,
setAngle: method on the
push behavior to set the angle (in radians) for the behavior.
After that, you will need to set the
magnitude, or the force behind the push. You can
set this force using the
setMagnitude: method of the push behavior. The
magnitude is calculated in this way: each magnitude of 1 point will
result in acceleration of 100 points per second squared for your target
Push behaviors, especially continuous pushes, are very useful. Let’s say you are working on a scrapbook iPad app, and on top of the screen, you have created three slides, each representing one of the scrapbook pages that the user has created. On the bottom of the screen, you have various pictures that the user can drag and drop into the pages. One way to allow the user to do this is to add a tap gesture recognizer (see Recipe 10.5) to your reference view to track the tap and allow the pictures to be moved onto the target slide, which will, in turn, simulate the dragging. The other, and perhaps better, way of doing this is to use the push behavior that Apple has introduced into UIKit.
The push behavior is of type
UIPushBehavior and has a magnitude ...