는 내가 다른 질문에서 발견 된이 기능을 사용하여보기로 시차 효과를 적용 : 그것은 잘 작동UIInterpolatingMotionEffect가 UIView의 프레임을 변경하지 않는 이유는 무엇입니까?
const static CGFloat kCustomIOS7MotionEffectExtent = 10.0;
- (void)applyMotionEffects:(UIView *)YOUR_VIEW
{
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
return;
}
UIInterpolatingMotionEffect *horizontalEffect = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x"
type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
horizontalEffect.minimumRelativeValue = @(-kCustomIOS7MotionEffectExtent);
horizontalEffect.maximumRelativeValue = @(kCustomIOS7MotionEffectExtent);
UIInterpolatingMotionEffect *verticalEffect = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y"
type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
verticalEffect.minimumRelativeValue = @(-kCustomIOS7MotionEffectExtent);
verticalEffect.maximumRelativeValue = @(kCustomIOS7MotionEffectExtent);
UIMotionEffectGroup *motionEffectGroup = [[UIMotionEffectGroup alloc] init];
motionEffectGroup.motionEffects = @[horizontalEffect, verticalEffect];
[YOUR_VIEW addMotionEffect:motionEffectGroup];
}
을,하지만 내가보기의 프레임을 로그인 한 후 발견하는 것은 변경하지 않습니다. 그들은 어떻게 그랬을까요? 특별한 이유가 있습니까? 시차 효과가 발생하면 실제 뷰 위치가 변경되기 때문에 개발을 계속하는 것이 훨씬 쉬워 지지만 실제로는 이해가되지 않습니다.