iOS - 如何控制 Unwind Segue 中的动画类型?
iOS - How to Control the Kind of Animation in an Unwind Segue?
我目前有一个应用有 3 个浏览量
- 屏幕 1 - 使用 'show' 转至屏幕 2
- 屏幕 2 - 使用 'modal' 转至屏幕 3
- 屏幕 3
我在屏幕 1 中有一个展开转场,并从屏幕 2 和屏幕 3 调用这个展开转场。
目前,当我从屏幕 3 调用屏幕 1 的 unwind segue 时,它以正在关闭的模态视图的形式呈现动画。
是否可以让这个展开转场动画成为标准 "pop" 转场动画,例如当屏幕从正常导航堆栈弹出时?
我能够通过为模态视图创建不同的 segue 来完成我想要的。关于我的界面还有一些额外的东西我不想解释,但是屏幕 3 现在取代了屏幕 2,没有模态转场。然后,当我在屏幕 3 上调用 unwind segue 时,它使用屏幕 1 中的 push segue 展开。
这是我在屏幕 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];
}
我目前有一个应用有 3 个浏览量
- 屏幕 1 - 使用 'show' 转至屏幕 2
- 屏幕 2 - 使用 'modal' 转至屏幕 3
- 屏幕 3
我在屏幕 1 中有一个展开转场,并从屏幕 2 和屏幕 3 调用这个展开转场。
目前,当我从屏幕 3 调用屏幕 1 的 unwind segue 时,它以正在关闭的模态视图的形式呈现动画。
是否可以让这个展开转场动画成为标准 "pop" 转场动画,例如当屏幕从正常导航堆栈弹出时?
我能够通过为模态视图创建不同的 segue 来完成我想要的。关于我的界面还有一些额外的东西我不想解释,但是屏幕 3 现在取代了屏幕 2,没有模态转场。然后,当我在屏幕 3 上调用 unwind segue 时,它使用屏幕 1 中的 push segue 展开。
这是我在屏幕 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];
}