There are animation elements (Label, Button, TextField) using UIDynamicAnimator, etc. After the animation, all the elements "roll" below at different angles. How to make their return to the original place, as it was before the animation?
@interface ViewController () { UIDynamicAnimator *animatir; UIGravityBehavior *gravity; UICollisionBehavior *collision; UIDynamicItemBehavior *bounce; } @end . . .
-(IBAction) buttonPressed: (id) sender { animatir = [[UIDynamicAnimator alloc]initWithReferenceView:self.view]; gravity = [[UIGravityBehavior alloc] initWithItems: @[label1, label2, label3, Edit1, Ediit2, Button2]]; [animatir addBehavior:gravity]; collision = [[UICollisionBehavior alloc]initWithItems:@[label1, label2, label3, Edit1, Ediit2, Button2]]; collision.translatesReferenceBoundsIntoBoundary = YES; [animatir addBehavior:collision]; bounce = [[UIDynamicItemBehavior alloc]initWithItems:@[label1, label2, label3, Edit1, Ediit2, Button2]]; bounce.elasticity = 0.90; [animatir addBehavior:bounce]; }