1

以下のコードを使用して、視差効果を使用して画面内の画像を移動します。

UIInterpolatingMotionEffect *verticalMotionEffect =
            [[UIInterpolatingMotionEffect alloc]
                    initWithKeyPath:@"center.y"
                               type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
    verticalMotionEffect.minimumRelativeValue = @(-20);
    verticalMotionEffect.maximumRelativeValue = @(20);

しかし、デバイスが上を向いているときの値は -20 です。デバイスが上を向いているときは 0 にする必要があります。UIInterpolatingMotionEffectの値にオフセットを追加するにはどうすればよいですか?

4

0 に答える 0