CATransition *transition = [CATransition animation];
//设置动画的持续时间f
transition.duration = 0.6;
//设置动画的加速方式
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
//设置动画的类型,每种动画类型对应了一种动画效果
transition.type = @"cube";
NSLog(@"%@",kCATransitionFade);
//子类型设置动画的方向
transition.subtype = kCATransitionFromTop;
// [self.forView.layer addAnimation:transition forKey:@"animationId"];
//
// [self.forView exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
/*
将动画对象,添加到导航控制器视图上,从而修改导航控制器push的动画效果
*/
[self.navigationController.view.layer addAnimation:transition forKey:@"navigationAnimation"];
UIViewController *viewController = [[UIViewController alloc] init];
viewController.view.backgroundColor = [UIColor greenColor];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];