-(CATransition *)MyCAnimation1:(UIView *)viewNum upDown:(BOOL )boolUpDown{
CATransition *animation = [CATransition animation];
animation.delegate =self;
animation.duration =0.5f ;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.endProgress =1;
animation.removedOnCompletion =NO;
animation.type =@"pageCurl";//101
if (boolUpDown) {
animation.subtype = kCATransitionFromRight;
}else{
animation.subtype = kCATransitionFromLeft;
}
return animation;
}
//加载到UINavigationConroller上
[self.navigationController.view.layer addAnimation:[self MyCAnimation1:self.view upDown:YES] forKey:@"animation"];
//本身动画要取消
//推入
[self.navigationControllerpushViewController:@"控制器对象" animated:NO];
//返回
[self.navigationControllerpopViewControllerAnimated:NO];
- (IBAction)CustomPushview { //自定义切换动画效果
CATransition *animation = [CATransition animation];
[animation setDuration:3.3];
[animation setType:kCATransitionFade]; //淡入淡出
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
MapViewController *mapview = [[MapViewController alloc] initWithNibName:Nil bundle:NULL];
[self.navigationController pushViewController:mapview animated:NO];
[self.navigationController.view.layer addAnimation:animation forKey:nil];
}
其他的动画效果可以自己去更改上面的一些动画属性和参数