向UIInterpolatingMotionEffect添加偏移量

时间:2013-10-28 15:59:44

标签: ios ios7

我使用下面的代码使用视差效果在屏幕上移动图像:

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

但是当设备面朝上时,值为-20,当设备面朝上时我需要它为0,如何将偏移添加到 UIInterpolatingMotionEffect的值

0 个答案:

没有答案