下面的代码实现了在一个立方体动画中两个视图之间的切换。
UIViewController* viewCtrl = [[UIViewController alloc] init:book];
CATransition *transition = [CATransition animation];
transition.duration = 1;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = @"cube";
transition.subtype = kCATransitionFromLeft;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
self.navigationController.navigationBarHidden = NO;
[self.navigationController pushViewController:viewCtrl animated:YES];
[viewCtrl release];
但是,如果视图不属于self.navigationController,如何在两个视图控制器之间使用立方体动画进行切换,然后同时缩放当前视图控制器的视图?非常感谢。