gpt4 book ai didi

iphone - 如何在不占据整个屏幕的 UIView 上使用 UIModalTransitionStylePartialCurl?

转载 作者:太空狗 更新时间:2023-10-30 03:10:29 27 4
gpt4 key购买 nike

在 Apple 的 iPhone 官方 map 应用程序中,右下角有一个小的“翻页”按钮。当您按下它时, map 本身会向后剥离以显示一些选项。我想在我自己的应用中复制这种效果。

我正在尝试使用 UIModalTransitionStylePartialCurl(在 SDK 3.2 中添加)。就其布局而言,我的应用程序几乎与 Apple 的官方 map 应用程序一模一样。我可以很容易地让整个屏幕向后剥离,露出下面的另一个 View ,但我不想要这个。我只想将 map View 剥离。

为了创建这种效果,您必须有一个将执行转换的 UIViewController。如果我将这个 UIViewController 的 View 设置为屏幕上某处不占据整个屏幕的小 subview ,我可以只让该 subview 剥离。那太棒了!然而,在过渡的第二部分之后(当页面回落到位时), View 永远不会回到它们开始的位置。向后剥离的 View 将从其原始位置移动,或者显示的 View 已扩展以占据整个屏幕。

我是否犯了任何明显的错误?如果有任何帮助,我将不胜感激!

我使用的代码非常简单。基本上只是:

underMapViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;

[curlableMapViewController presentModalViewController:underMapViewController animated:YES];

最佳答案

来自Documentation :

UIModalTransitionStylePartialCurl

When the view controller is presented, one corner of the current view curls up to reveal the modal view underneath. On dismissal, the curled up page unfurls itself back on top of the modal view. A modal view presented using this transition is itself prevented from presenting any additional modal views.

This transition style is supported only if the parent view controller is presenting a full-screen view and you use the UIModalPresentationFullScreen modal presentation style. Attempting to use a different form factor for the parent view or a different presentation style triggers an exception.

尽管如此,我在使用除全屏以外的其他演示文稿时没有遇到任何异常。我正在测试,我遇到了和你一样的问题。我发现如果我的 ParentViewController 的 View 是一个 ImageView 并且我将内容模式设置为 UIViewContentModeCenter,则 View 不会调整大小或移动。也许有一个解决方法,将当前 View 保存为图像,将其放在顶部,进行 curl ,然后在关闭模态后,重新排列困惑的隐藏内容并删除顶部 ImageView 。我知道这听起来很疯狂,但如果我真的必须完成该要求,我会尝试这样做。

豪尔赫,希望这对您有所帮助。

关于iphone - 如何在不占据整个屏幕的 UIView 上使用 UIModalTransitionStylePartialCurl?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3851914/

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