UIPopoverController 没有动画
我有一个 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尽管有
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
todismissPopoverAnimated:(BOOL)
假设您的弹出窗口在地图视图之外进行动画处理,我会尝试将地图视图放入容器视图中,该容器视图的框架与地图视图的大小相同。从那里开始,在容器视图中呈现弹出窗口就很简单了。
根据 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.