0

UIKit Dynamics を使用してサブビューを下に移動しようとしています。サブビューを特定の位置に移動する必要がありますが、メイン ビューのずっと下まで移動してもうまくいきません。これが私のコードです:

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];

私がやろうとしているのは、サブビューを下げて、必要な位置に戻すことです。この場合、サブビューにこの最終的なオリゲン(352,700)を持たせたいです

これを行う方法を知っている人はいますか?または回避策?

よろしくお願いします。

4

1 に答える 1