iphone - MKMapView 叠加层在 appDidBecomeActive 上重置

标签 iphone ios mkmapview mapkit

我有一个带有一堆叠加层的 map View 。当我按下主页按钮并重新打开它时,所有叠加层都会消失一秒钟,然后立即重新出现。起初,我以为是我的代码在执行此操作,但我几乎在各处都放置了断点,而且我的代码似乎都没有触发“重置”。在叠加层重新出现之前,甚至 mapView:viewForOverlay: 也不会被调用。

我认为这可能是 MKMapView 不可避免的行为,但似乎 Maps.app 也没有这样做 - 如果您计算路线并退出/重新打开应用程序,叠加层始终保留在那里。

我想也许 MKMapView 在退出时默认清除其所有注释/覆盖,因此在保持后台时占用更少的内存。有什么办法可以避免这种情况吗?有点像 Maps.app 那样吗?

编辑:here's a small project我放在一起来演示这个问题。只需在模拟器中启动它,单击主页按钮,然后重新打开它。您会看到 map 路径叠加层消失了一会儿。

最佳答案

这更多的是后续而不是实际的答案,但基本上这个问题已被苹果标记为错误。我不久前将其作为 TSI 提交给 Apple,并收到了以下答复:

Thanks for providing a sample project. I don't see any issues in your code. At this point I recommend escalating the issue to engineering by filing a bug about the "flicker" from the MKPolylineView being redrawn at https://developer.apple.com/bugreporter/ and sending me the bug number so I can use it to follow up.

然后我提交了雷达#11041378

Thanks again for your bug report. As it happens, I don't have a workaround for you at this time. Engineering is still working on the issue, but I don't have a timeline for a fix.

I'll go ahead and leave this incident open for you as long as bug 11041378 is open. If you have any questions about it's status in the future, or the status of a workaround, feel free to reply back and I will check it for you.

If you have any comments for engineering, or want to tell the story of why it's important to your situation, I'd actually encourage you to put that directly in the bug. Since it's been assigned to engineering, any comments will go directly to them.

我附加了以下评论,描述了为什么这个问题对我很重要:

This bug feels rather important to me as the user expects to find the app in the exact state he left it when he quit the app. The flickering overlays (sometimes disappearing for less than second, other times for 2-3s) may get the user confused about what is going on, when all he really wants is to interact with the map/overlays right away.

此后就没有收到苹果的回复了。希望 iOS 6 能解决这个问题吗?

关于iphone - MKMapView 叠加层在 appDidBecomeActive 上重置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9658773/

相关文章:

ios - 将 View 从 MKMapKit 转换为区域

iphone - 适用于 iPhone 应用程序的可用且最有利可图的广告系统?

ios - "Format string is not string literal (potentially insecure)"

ios - 为什么 [UIScreen mainScreen].bounds] 没有返回全屏大小?

ios - 基于时间的问候应用程序无法正常工作, swift

ios - 在 UIView 中显示 native iOS 日历

iphone - 向 UIMapView 添加可点击注释

ios - 我尝试向我的应用程序添加 map ,但我看到的只是黑屏......为什么?

iphone - 如何为 iOS 构建 PoDoFo 库

ios - 如何添加 UIViewController 作为在以编程方式创建的 UIView 中创建的 UIButton 操作的目标?