gpt4 book ai didi

ios - ModalTransitionStyle 水平覆盖

转载 作者:行者123 更新时间:2023-12-02 00:12:35 26 4
gpt4 key购买 nike

在我的 iPhone 应用程序中,我使用了多个模态视图。当我呈现一个新的 View Controller 时,我总是使用其中一个过渡动画

(UIModalTransitionStylePartialCurl,UIModalTransitionStyleFlipHorizontal
UIModalTransitionStyleCoverVertical,UIModalTransitionStyleCrossDissolve)

我正在寻找的内容将被称为UIModalTransitionStyleCoverHorizo​​ntal,但没有这样的东西。然而,在很多应用程序(iOS 和第 3 方)中,我看到了这种水平覆盖过渡。

有人知道如何实现这一目标吗?

最佳答案

我也回答一下我的问题。@Max Justicz 所说的是一种方法。另一种方法是在 UINavigationController 中完成。

您创建要从中导航的 UIViewController:

UIViewController* controller1 = [[UINavigationController alloc]init];

还创建一个 UINavigationController 并使用 Controller 初始化它

UINavigationController* controllerNVC = [[UINavigationController alloc]initWithRootViewController: controller1];

然后在“controller's .m”文件中,当你想要导航时,这样做。

UIViewController* controller2 = [[UINavigationController alloc]init];
[[self navigationController] pushViewController:controller2 animated:YES];

这会将 Controller 2推送到 Controller 1上。

当你想从controller2返回时,只需调用:

[[self navigationController]popViewControllerAnimated:YES];

这样您就可以使用水平封面动画方式在 View 之间导航

关于ios - ModalTransitionStyle 水平覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11897754/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com