MKMapView 重新加载问题

发布于 2024-08-03 08:02:12 字数 219 浏览 4 评论 0原文

我有一个包含 MKMapView 的控制器。当用户弹回到前一个控制器时我保留它,然后当用户想要返回地图时将其推回。当用户离开控制器时正在进行胺化时,就会出现此问题。当我重新按下控制器时,屏幕上的动画会冻结在弹出控制器时的状态。当用户触摸屏幕时,视图会更新并且正常。我尝试添加

[mapView setNeedsDisplay];

但没有运气。有什么想法吗?

I have a controller containing a MKMapView. I retain it when the user pops back to the previous controller and then push it back when the user want to return to the map. The problem occurs when an amination is in progress when the user leaves the controller. When I re push the controller the animation is on the screen frozen in the state it was in when the controller was popped. When the user touches the screen the view updates and is fine. I have tried adding

[mapView setNeedsDisplay];

with no luck. Any ideas?

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

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

发布评论

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

评论(2

无声情话 2024-08-10 08:02:12

我最终通过切换当前位置注释来解决这个问题。这似乎迫使地图按照我需要的方式更新。

mapView.showsUserLocation = NO;
mapView.showsUserLocation = YES;

I ended up fixing this by toggling the current location annotation. This seems to force the map to update in the way I needed.

mapView.showsUserLocation = NO;
mapView.showsUserLocation = YES;
洒一地阳光 2024-08-10 08:02:12

当我以编程方式滚动到某个位置时,即使视图没有离开,我也遇到了类似的问题。使用我想要的区域调用 regionThatFits: 似乎可以修复它,但我还没有调查原因。不确定这是否能解决您的问题,但也许值得一试?

I had a similar issue when I was programmatically scrolling to a spot in general, even if the view wasn't left. Calling regionThatFits: with the region I wanted seemed to fix it, but I haven't investigated why yet. Not sure if this would fix your issue, but worth a shot maybe?

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