I have a view that has some scale transformations. And when I apply some UIKit Dynamics on it, it zeroes them out. /: How can I keep the existing transformation on the view whil
Take a look at UIDynamicAnimator's updateItemUsingCurrentState.
A dynamic animator automatically reads the initial state (position and rotation) of each dynamic item you add to it, and then takes responsibility for updating the item’s state. If you actively change the state of a dynamic item after you’ve added it to a dynamic animator, call this method to ask the animator to read and incorporate the new state.
So anytime you change the transform after the item you're transforming has been added to an animator, just call updateItemUsingCurrentState
right after.
id dynamicItem; // whatever your item is, probably a UIView
UIGravityBehavior *behavior = [[UIGravityBehavior alloc] initWithItems:@[dynamicItem]];
UIDynamicAnimator *animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; // or however you're getting your animator
[animator addBehavior:behavior];
view.transform = CGAffineTransformMakeScale(1.5, 1.5);
[animator updateItemUsingCurrentState:view];