1 UILabel *lb=[[UILabel alloc] init];
2 UIInterpolatingMotionEffect *motinEffect;
3 motinEffect=[[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
4 motinEffect.minimumRelativeValue=@(-25);
5 motinEffect.maximumRelativeValue=@(25);
6 [lb addMotionEffect:motinEffect];
7 motinEffect=[[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
8 motinEffect.maximumRelativeValue=@(25);
9 motinEffect.minimumRelativeValue=@(-25);
10 [lb addMotionEffect:motinEffect];
11
12 [self.view addSubview:lb];