mbaranowski
1/15/2014 - 9:24 PM

gistfile1.m

   UIMotionEffectGroup* effectGroup = [[UIMotionEffectGroup alloc] init];
    
    UIInterpolatingMotionEffect* horizontalParallax =
    [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center"
                                                    type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];


    UIInterpolatingMotionEffect* verticalParallax =
    [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center"
                                                    type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
    
    
    CGFloat offset = 50;
    horizontalParallax.minimumRelativeValue = [NSValue valueWithCGPoint:CGPointMake(-offset, 0)];
    horizontalParallax.maximumRelativeValue = [NSValue valueWithCGPoint:CGPointMake( offset, 0)];
    verticalParallax.minimumRelativeValue = [NSValue valueWithCGPoint:CGPointMake( 0, -offset)];
    verticalParallax.maximumRelativeValue = [NSValue valueWithCGPoint:CGPointMake( 0,  offset)];
    
    effectGroup.motionEffects = @[horizontalParallax, verticalParallax];
    
    [self.blurredBackgroundView addMotionEffect:effectGroup];