0

UIKitDynamics を使用していくつかのボタンにアニメーションを追加したいのですが、UISnapBehaviour で非常に基本的なことを行うことはまったく機能しません。IB を使用してすべてのサブビューをレイアウトしているため、self.button.frame を呼び出しても再配置できないことに注意してください。制約を使用する必要があります。

そうは言っても、私が持っているものは次のとおりです...アニメーションを実行すると、すばやく点滅し、ひどく見えます。

// Position the buttons off screen
        self.swerveButton.translatesAutoresizingMaskIntoConstraints = NO;
        self.followButton.translatesAutoresizingMaskIntoConstraints = NO;
        self.swerveButtonTopSpaceConstraint.constant = -200;

        CGPoint swerveSnapPoint = self.swerveButton.center;
        CGPoint followSnapPoint = self.followButton.center;

        UISnapBehavior *followSnap = [[UISnapBehavior alloc] initWithItem:self.followButton
                                                              snapToPoint:followSnapPoint];

        UISnapBehavior *swerveSnap = [[UISnapBehavior alloc] initWithItem:self.swerveButton
                                                              snapToPoint:swerveSnapPoint];


        [self.overlayView fadeInWithDuration:0.2 completion:^{
            swerveSnap.damping = 0.3;
            [self.animator addBehavior:swerveSnap];

            followSnap.damping = 0.3;
            [self.animator addBehavior:followSnap];
        }];
    }
4

1 に答える 1