UIPopoverController 没有动画

发布于 2024-10-22 21:47:49 字数 652 浏览 9 评论 0原文

我有一个 iPad 应用程序,其中嵌入了 UINavigationController 中的 MKMapView,并显示在 UITabBar 中。我正在地图上显示一个弹出窗口控制器,

UIPopoverController *myPopoverController =
    [[[UIPopoverController alloc] initWithContentViewController:myContentView]
     autorelease];

[myPopoverController presentPopoverFromRect:myRect
                                     inView:mapView
                   permittedArrowDirections:UIPopoverArrowDirectionAny
                                   animated:YES];

弹出窗口显示良好。然而,它没有很好的动画效果:它只是立即出现在屏幕上。同样,当我关闭它时,它就会消失,没有任何动画。

有人知道如何让动画发挥作用吗?我应该尝试从另一个视图显示它吗?是否有一些我可能忽略设置的属性?

I have an iPad app that has an MKMapView embedded in a UINavigationController which is displayed in a UITabBar. I am displaying a popover controller over the map with

UIPopoverController *myPopoverController =
    [[[UIPopoverController alloc] initWithContentViewController:myContentView]
     autorelease];

[myPopoverController presentPopoverFromRect:myRect
                                     inView:mapView
                   permittedArrowDirections:UIPopoverArrowDirectionAny
                                   animated:YES];

The popover displays fine. However, it does not have the nice animated effect: it just immediately appears onscreen. Similarly, when I dismiss it it just disappears without any animation.

Anybody have any idea how I can get the animation to work? Should I try displaying it from another view? Is there some property on something that I might have neglected to set?

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

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

发布评论

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

评论(2

七婞 2024-10-29 21:47:49

尽管有 animated:(BOOL) 参数,但弹出窗口在呈现时似乎永远不会动画。我已经尝试了十几个第一方和第三方应用程序。

但是,如果您将 YES 传递给 dismissPopoverAnimated:(BOOL),则解雇应该以动画形式呈现

Despite the animated:(BOOL) parameter, it appears popovers never animate when presented. I've tried a dozen first and third party apps.

The dismissal should animate however, provided you pass YES to dismissPopoverAnimated:(BOOL)

泛滥成性 2024-10-29 21:47:49

假设您的弹出窗口在地图视图之外进行动画处理,我会尝试将地图视图放入容器视图中,该容器视图的框架与地图视图的大小相同。从那里开始,在容器视图中呈现弹出窗口就很简单了。

根据 Apple 的文档,MKMapView 不应该被子类化,所以像 UIWebView 一样,它让我觉得它是最好保持不变的视图之一。

Assuming your popover animates outside the map view, I would try placing the map view into a container view whose frame is the same size as the map view's. From there, it's trivial to present the popover in the container view.

According to Apple's documentation, MKMapView isn't supposed to be subclassed, so like UIWebView, it strikes me as one of those views whose guts are better left untouched.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文