I'm trying to move down a subview using UIKit Dynamics. I need to move the subview to a particular position but it doesn't work it goes all the way down of the main view. Here is my code:
UIView *mySubview = [self.view viewWithTag:102];
self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
self.gravityBehavior = [[UIGravityBehavior alloc] initWithItems:@[mySubview]];
self.gravityBehavior.magnitude = 1;
[self.animator addBehavior:self.gravityBehavior];
self.collisionBehavior = [[UICollisionBehavior alloc] initWithItems:@[ mySubview]];
[self.collisionBehavior addBoundaryWithIdentifier:@"bottom"
fromPoint:CGPointMake(352, 233)
toPoint:CGPointMake( 352,700)];
self.collisionBehavior.translatesReferenceBoundsIntoBoundary = YES;
[self.animator addBehavior:self.collisionBehavior];
self.bounceBehaviour = [[UIDynamicItemBehavior alloc] initWithItems:@[ mySubview]];
self.bounceBehaviour.elasticity = 0.6;
[self.animator addBehavior:self.bounceBehaviour];
What I'm trying to do is let the subview go down and bounce back to the position I want in this case I want the subview to have this final origen (352,700)
any of you knows how can do this? or a work around ?
I'll really appreciate your help.