需要在frameworks中添加QuartzCore.framework
在接口程序中加上头文件 #import <QuartzCore/QuartzCore.h>
/*好多动画效果*/
CATransition *transition = [CATransition animation];
transition.duration = 1.0f; /* 间隔时间*/
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; /* 动画的开始与结束的快慢*/
transition.type = @"rippleEffect"; /* 各种动画效果*/
//@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip"
transition.subtype = kCATransitionFromRight; /* 动画方向*/
transition.delegate = self;
[navigationController.view.layer /* 在想添加CA动画的VIEW的层上添加此代码*/ addAnimation:transition forKey:nil];
//另外加一句,transition在申请时用的是+方法,所以不需要自己进行release ,在层上添加后不要认为retainCount已经+1,就还要release
//实际上CATransition类中还有一个属性是removedOnCompletion,是此动画执行完后会自动remove,默认值为true