pushViewController自定义动画

实现的主要代码如下:

[objc]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  1. CATransition *transition = [CATransition animation];  
  2. transition.duration = 1.0f;  
  3. transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];  
  4. transition.type = @"cube";  
  5. transition.subtype = kCATransitionFromRight;  
  6. transition.delegate = self;  
  7. [self.navigationController.view.layer addAnimation:transition forKey:nil];  
  8.   
  9. FirstViewController *firstViewController = [[DemoViewController alloc]init];  
  10. [self.navigationController pushViewController: firstViewController animated:YES];   


如果只是应用淡入淡出效果,不要navigation push的动画,可以将animated设置为NO,即可实现。


其中的动画类型有:

[objc]  view plain  copy
 print ? 在CODE上查看代码片 派生到我的代码片
  1. animation.type = kCATransitionFade;  
  2.   
  3. animation.type = kCATransitionPush;  
  4.   
  5. animation.type = kCATransitionReveal;  
  6.   
  7. animation.type = kCATransitionMoveIn;  
  8.   
  9. animation.type = @"cube";  
  10.   
  11. animation.type = @"suckEffect";  
  12.   
  13. // 页面旋转  
  14. animation.type = @"oglFlip";  
  15.   
  16. //水波纹  
  17. animation.type = @"rippleEffect";  
  18.   
  19. animation.type = @"pageCurl";  
  20.   
  21. animation.type = @"pageUnCurl";  
  22.   
  23. animation.type = @"cameraIrisHollowOpen";  
  24.   
  25. animation.type = @"cameraIrisHollowClose";  
转自:http://blog.csdn.net/ralbatr/article/details/22039233



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值