gpt4 book ai didi

ios - 为什么MKMapView的mapView是:viewForOverlay: not called when userlocation is enabled?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:21:48 25 4
gpt4 key购买 nike

我已经在我的 MKMapView 中添加了一些 MKPolygons,它们在 MKMapView 中显示得很好。如果我现在为此 MKMapView 启用 userLocation 并且用户授予其位置权限,则不会调用任何委托(delegate),也不会绘制任何叠加层。在下一个 viewDidLoad 之后,委托(delegate)再次正常工作并显示所有叠加层。

所以问题似乎只会出现,如果用户被要求授予对其位置的权限。

我希望有人对这种奇怪的行为有解释/解决方案,谢谢。

更新

正如我所发现的,它与用户位置无关。不知何故,MKMapView 没有调用它的委托(delegate)来绘制叠加层,但前提是它是第一次应用程序启动期间的初始 View 。之后一切正常。

最佳答案

只需将设置代码移动到它自己的方法中,并从 viewDidLoad 和用户跟踪委托(delegate)方法之一(如 mapView:didChangeUserTrackingMode:animated: 调用它>mapViewWillStartLocatingUser:.

关于ios - 为什么MKMapView的mapView是:viewForOverlay: not called when userlocation is enabled?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10869356/

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