Marcus Zarra在SDK邮件列表中发布了一个很好的解决方案:
UIViewController *controller = [[[MyViewController alloc] init] autorelease];
UIViewAnimationTransition trans = UIViewAnimationTransitionCurlUp;
[UIView beginAnimations: nil context: nil];
[UIView setAnimationTransition: trans forView: [self window] cache: YES];
[navController presentModalViewController: controller animated: NO];
[UIView commitAnimations];
有用于翻转和页面卷曲的过渡。如果您设置了淡入淡出,可以尝试调整新视图的Alpha:
UIViewController *controller = [[[MyViewController alloc] init] autorelease];
controller.view.alpha = 0.0;
[navController presentModalViewController: controller animated: NO];
[UIView beginAnimations: nil context: nil];
controller.view.alpha = 1.0;
[UIView commitAnimations];
但是,您可能想要的是淡入淡出效果,或者至少是淡入淡出效果。当UINavigationController切换到新视图时,它将删除旧视图。为了达到这种效果,最好将一个新视图添加到现有的UIViewController中,然后逐渐淡化其alpha。
注意:如果您不在应用程序委托中,则[自身窗口]将不起作用。使用self.view.window,这要感谢user412500的帖子指出了这一点。