【移动视图偏移】
@interface UIView (UIViewMotionEffects)
具体看 UIMotionEffect 部分
- (void)addMotionEffect:(UIMotionEffect *)effect NS_AVAILABLE_IOS(7_0);
- (void)removeMotionEffect:(UIMotionEffect *)effect NS_AVAILABLE_IOS(7_0);
@property (copy, nonatomic) NSArray *motionEffects NS_AVAILABLE_IOS(7_0);
UIInterpolatingMotionEffect * xEffect = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x"type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
xEffect.minimumRelativeValue = [NSNumber numberWithFloat:-40.0];
xEffect.maximumRelativeValue = [NSNumber numberWithFloat:40.0];
[redView addMotionEffect:xEffect];
/*
typedef NS_ENUM(NSInteger, UIInterpolatingMotionEffectType) {
UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis,
UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis
*/
@end