我正在寻找使用 curl up 动画执行 segue 以将窗口的根视图控制器替换为另一个视图控制器。这个想法是,在使用 curl up 动画转换 ( ) 到下一个之前,我会SplashViewController显示几秒钟。performSegueWithIdentifier:LoginViewController
我创建了一个UIStoryboardSegue名为AnimatedSegue. 下面是重写perform方法的代码:
- (void)perform
{
  UIViewController *source = self.sourceViewController;
  UIViewController *destination = self.destinationViewController;
  UIWindow *window = source.view.window;
  [UIView transitionFromView:source.view
                      toView:destination.view
                    duration:1.0
                     options:UIViewAnimationOptionTransitionCurlUp
                  completion:^(BOOL finished) {
                    [window setRootViewController:destination];
                  }];
}
它工作正常,除了在 iOS 6 中(显然不是在 iOS 5 中)该方法在视图控制器viewWillAppear:上被调用两次。destination似乎它在过渡期间被称为第一次,在执行时被称为第二次[window setRootViewController:destination];
请注意,我不想使用导航控制器。SplashViewController一旦过渡结束,就会被释放(如预期的那样)。
关于如何解决我的问题的任何想法?