我正在解雇一个模态视图控制器,然后立即呈现另一个模态视图控制器,但我目前无法在它们两个上只使用第二个动画. 
  
 
反正是否有延迟过程以便用户体验两种动画?
下面的代码目前有效,但用户只能看到第二个动画:
// First one configure detailViewController.modalPresentationStyle = UIModalPresentationFullScreen; detailViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl; [self presentModalViewController:detailViewController animated:YES]; //dismiss first one [self dismissModalViewControllerAnimated:NO]; //Immediately configure and show second one navController.modalPresentationStyle = UIModalPresentationFormSheet; navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:navController animated:YES];
解决方法
 现在有一个完整的块可用于现有的模态视图控制器.请参阅此 
 LINK.这在iOS5.0中可用. 
  
 
        这样做的好处是,如果要使用定时器解决方案,则无需估计定时器延迟.
只需将第二个动画的代码放入块中:
//Block safe reference to self to prevent retain cycles
__block typeof (self) selfReference = self;
// First one configure
detailViewController.modalPresentationStyle = UIModalPresentationFullScreen;
detailViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl; 
[self presentModalViewController:detailViewController animated:YES completion:
^{
    //dismiss first one
    [selfReference dismissModalViewControllerAnimated:NO]; 
    //Immediately configure and show second one
    navController.modalPresentationStyle = UIModalPresentationFormSheet;
    navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [selfReference presentModalViewController:navController animated:YES];
 }];