by 伍雪颖

- (void)registerEffectForView:(UIView *)aView depth:(CGFloat)depth;
{
     UIInterpolatingMotionEffect *effectX;
     UIInterpolatingMotionEffect *effectY;
    effectX = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x"
                                                              type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
    effectY = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y"
                                                              type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
    
    
     effectX.maximumRelativeValue = @(depth);
     effectX.minimumRelativeValue = @(-depth);
     effectY.maximumRelativeValue = @(depth);
     effectY.minimumRelativeValue = @(-depth);
    
     [aView addMotionEffect:effectX];
     [aView addMotionEffect:effectY];
}


相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-06-24
  • 2021-05-16
  • 2022-12-23
  • 2021-08-02
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
  • 2022-02-25
  • 2022-03-04
  • 2022-01-02
  • 2022-12-23
相关资源
相似解决方案