你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> ios7自帶的晃動效果

ios7自帶的晃動效果

編輯:IOS開發綜合

ios7自帶的晃動效果

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];
}


  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved