pushViewController自定义动画

实现的主要代码如下:

CATransition *transition = [CATransition animation];

transition.duration = 1.0f;

transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

transition.type = @"cube";

transition.subtype = kCATransitionFromRight;

transition.delegate = self;

[self.navigationController.view.layer addAnimation:transition forKey:nil];

FirstViewController *firstViewController = [[DemoViewController alloc]init];

[self.navigationController pushViewController: firstViewController animated:YES];

其中的动画类型有:

  1. animation.type = kCATransitionFade;
  2. animation.type = kCATransitionPush;
  3. animation.type = kCATransitionReveal;
  4. animation.type = kCATransitionMoveIn;
  5. animation.type = @"cube";
  6. animation.type = @"suckEffect";
  7. animation.type = @"oglFlip";  // 页面旋转
  8. animation.type = @"rippleEffect"; //水波纹
  9. animation.type = @"pageCurl";
  10. animation.type = @"pageUnCurl";
  11. animation.type = @"cameraIrisHollowOpen";
  12. animation.type = @"cameraIrisHollowClose";  

返回按钮的动画实现事件

    1. // 修改导航栏的 左边的标题
    2. self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIButtonTypeRoundedRect target:self action:@selector(back)];
上一篇:BZOJ3404: [Usaco2009 Open]Cow Digit Game又见数字游戏


下一篇:JSP验证码