使用 UINavigationController 链接 UIViewControllers 推送和弹出动画关闭/呈现模式视图?

发布于 2024-10-14 10:49:02 字数 588 浏览 2 评论 0原文

我有一个带有(导航控制器)的视图控制器,可以在两个视图(列表和地图)之间翻转,用户可以在视图之间切换。地图是模态视图。目前,我已经使用“

当用户选择一个位置时,它将沿着层次结构向下移动并显示一些位置详细信息”来完成此操作。在此层次结构中,用户仍然可以选择查看地图。如果我立即调用 UIViewController 方法 - ( void)presentModalViewController:(UIViewController *)modalViewControlleranimated:(BOOL)animated 它同时执行两个动画,看起来有点混乱。

就目前情况而言,我决定添加一个短 NSTimer 来延迟 - (void)presentModalViewController:(UIViewController *)modalViewControllerAnimated:(BOOL)animated 的调用。

我的问题是,有没有更干净的方法来做到这一点?我想一个类似的例子是,如果您正在使用 App Store 应用程序并且您已经下载了一个新应用程序。应用程序商店存在,然后动画到应用程序的最后一页(假设您还不在那里),我正在寻找这种动画风格。

非常感谢

I have View Controller with a (navigation controller) that can flip between 2 views (list and map), the user can switch between views. The map is the modal view. Currently I have done this using

When the user selects a location it will go down a hierarchy and present some location details. In this hierarchy the user still has the option to view the map. I am currently taking the user back to the root controller using the UINavigationController method - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated with animated being YES, if I immediately call the UIViewController method - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated it does both animations together, looking a little messy.

As it stands I decided to add a short NSTimer to delay the - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated being called.

My question, is there a cleaner way of doing this? A similar example I suppose is if you're using the App Store application and you've downloaded a new app. The app store exists then animates to the last page of apps (assuming you're not there already), I'm looking for this style of animation.

Many thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸠书 2024-10-21 10:49:02

您走在正确的轨道上,但您可以通过使用跳过使用 NSTimer 的步骤
performSelector:withObject:afterDelay:

...
   [self performSelector:showModalController withObject:nil afterDelay:2.0];
...

-(void)showModalController
{
   [self presentModalViewController:myModalViewController animated:YES];
}

You are on the right track but you can skip the step of using the NSTimer by using
performSelector:withObject:afterDelay:

...
   [self performSelector:showModalController withObject:nil afterDelay:2.0];
...

-(void)showModalController
{
   [self presentModalViewController:myModalViewController animated:YES];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文