0

我目前有一个有 3 个视图的应用程序

  1. 屏幕 1 - 使用“显示”转场转到屏幕 2
  2. 屏幕 2 - 使用“模态”转场转到屏幕 3
  3. 屏幕 3

我在屏幕 1 中有一个展开转场,并从屏幕 2 和屏幕 3 调用此展开转场。

目前,当我从屏幕 3 调用屏幕 1 的展开转场时,它会作为一个正在关闭的模态视图进行动画处理。

是否有可能让这种展开转场为标准的“弹出”转场设置动画,例如当屏幕从正常导航堆​​栈中弹出时?

4

1 回答 1

0

通过为模态视图创建不同的转场,我能够完成我想要的。关于我的界面还有一些我不想解释的额外内容,但 Screen 3 现在取代了 Screen 2,没有模态 segue。然后,当我在屏幕 3 上调用展开转场时,它会使用屏幕 1 中的推送转场展开。

这是我在屏幕 2 和屏幕 3 之间使用的自定义转场:

-(void)perform {
    UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
    UIViewController *destinationController = (UIViewController*)[self destinationViewController];
    UINavigationController *navigationController = sourceViewController.navigationController;
    // Pop to root view controller (not animated) before pushing
    [navigationController popToRootViewControllerAnimated:NO];
    [navigationController pushViewController:destinationController animated:NO];
}
于 2015-08-15T15:14:44.903 回答