I'm looking at Apple documentation for UIPushBehavior and it confuses me in instantaneous mode. I know that the acceleration formula is Force = Mass * acceleration. I assume that mass of a view is width*height*density(1). The documentation describes push magnitude as follows:
The default magnitude is nil, equivalent to no force. A continuous force vector with a magnitude of 1.0, applied to a 100 point x 100 point view whose density value is 1.0, results in view acceleration of 100 points / second² in the direction indicated by the angle or pushDirection property.
This makes sense in terms of continuous pushing, where it provides constant acceleration. It does not say anything about intantaneous push. How can I understand what velocity an instantaneous push of magnitude 1 will provide to a 100x100 view?
EDIT: it seem like @martin have a better answer. Please check it. I haven't had time to check it yet.
There is no acceleration in the case of an instantaneous push (UIPushBehaviorModeInstantaneous
).
Then for you can't play with magnitude
(it have no impact).
Instead you can play with the pushDirection
vector value.
ie.:
pushBehavior.pushDirection = CGVectorMake(100, 100);
Also you could add a UIDynamicItemBehavior
to act directly on the behavior of the object your moving in order to add some resistance
, friction
, ... If you want slow it down
UIDynamicItemBehavior *resistanceBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[view]];
resistanceBehavior.resistance = 1.0;
[self.animator addBehavior:resistanceBehavior];