iOS 页面之间的专长动画控制器间的转换

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; line-height: 24.0px; font: 14.0px "Heiti SC Light"; color: #323333; background-color: #f3feec }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; line-height: 24.0px; font: 14.0px Arial; color: #323333; background-color: #f3feec; min-height: 16.0px }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; line-height: 24.0px; font: 14.0px "PingFang SC"; color: #323333; background-color: #f3feec }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff }
p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px }
p.p6 { margin: 0.0px 0.0px 0.0px 0.0px; line-height: 24.0px; font: 14.0px Arial; color: #323333; background-color: #f3feec }
span.s1 { font: 14.0px Arial }
span.s2 { color: #ffffff }
span.s3 { }
span.s4 { font: 11.0px "PingFang SC" }
span.s5 { font: 14.0px "Heiti SC Light" }
span.s6 { color: #2d64b3 }
span.s7 { font: 14.0px "Heiti SC Light"; color: #2d64b3 }

CATransition类实现层的转场动画。你可以从一组预定义的转换或者通过提供定制的CIFilter实例来指定转场效果。

例如:控制器之间的跳转

LoginViewController *myVC = [[LoginViewController alloc]init];

myVC.tuichu = @"tuichu";

//创建动画

CATransition *animation = [CATransition animation];

//设置运动轨迹的速度

animation.timingFunction = UIViewAnimationCurveEaseInOut;

//设置动画类型为立方体动画

animation.type = @"cube";

//设置动画时长

animation.duration =0.5f;

//设置运动的方向

animation.subtype =kCATransitionFromRight;

//控制器间跳转动画

[[UIApplication sharedApplication].keyWindow.layer addAnimation:animation forKey:nil];

[self presentViewController:myVC animated:NO completion:nil];

//例如;控制器中添加 view

CATransition *animation = [CATransition animation];

animation.timingFunction = UIViewAnimationCurveEaseInOut;

animation.type = @"rippleEffect"; //声波效果

animation.duration = 0.3;

animation.subtype = kCATransitionFromBottom;

[self.view.layer addAnimation:animation forKey:nil];

[self.view addSubview:view];

  //定义个转场动画

  CATransition *animation = [CATransition animation];

  //转场动画持续时间

  animation.duration = 0.2f;

  //计时函数,从头到尾的流畅度???

  animation.timingFunction=UIViewAnimationCurveEaseInOut;

  //转场动画类型

  animation.type = kCATransitionReveal;

  //转场动画将去的方向

  animation.subtype = kCATransitionFromBottom;

  //动画时你需要的实现

  self.tabBarController.tabBar.hidden = YES;

  //添加动画 (转场动画是添加在层上的动画)

  self.tabBarController.tabBar.layer addAnimation:animation forKey:@"animation"];

  说明:

  duration:动画持续的时长。

  timingFunction:没明白(谁明白的说明一下吧)

  type:转场动画的类型。如果在一个自定义的转场动画中指定的过滤器属性,此属性将被忽略。

  type共有四种类型:

  NSString * const kCATransitionFade;//逐渐消失

  NSString * const kCATransitionMoveIn;//移入

  NSString * const kCATransitionPush;//平移(暂且这么称呼吧)

  NSString * const kCATransitionReveal;//显露

  默认类型为kCATransitionFade。

  subtype:转场动画将要去往的方向。

  subtpye有四种类型:

  NSString * const kCATransitionFromRight;

  NSString * const kCATransitionFromLeft;

  NSString * const kCATransitionFromTop;

  NSString * const kCATransitionFromBottom;

  默认方向是nil。

  [self.tabBarController.tabBar.layer addAnimation:animation forKey:@"animation"];

  转场动画是添加给layer的!

  switch (btn.tag) {

  case 0:

  animation.type = @"cube";//---立方体

  break;

  case 1:

  animation.type = @"suckEffect";//103 吸走的效果

  break;

  case 2://前后翻转效果

  animation.type = @"oglFlip";//When subType is "fromLeft" or "fromRight", it's the official one.

  break;

  case 3:

  animation.type = @"rippleEffect";//110波纹效果

  break;

  case 4:

  animation.type = @"pageCurl";//101翻页起来

  break;

  case 5:

  animation.type = @"pageUnCurl";//102翻页下来

  break;

  case 6:

  animation.type = @"cameraIrisHollowOpen ";//107//镜头开

  break;

  case 7:

  animation.type = @"cameraIrisHollowClose ";//106镜头关

  break;

  default:

  break;

  }

上一篇:interproscan 的使用和遇到的问题


下一篇:什么是响应式设计?响应式设计的基本原理是什么?如何兼容低版本的 IE?