iphone app: Questions on interaction between CLLocationmanager and MKMapView (showing current user location)

我的未来我决定 提交于 2019-12-05 10:00:23

My understanding (based on what I see, not on documentation because I can't seem to find any that covers this) is that the showsUserLocation property causes the mapView to start a CLLocationManager instance using the highest accuracy settings (1m distance filter, best accuracy), and then update its blue circle annotation view as that location manager returns updates. It also updates a circular overlay based on the horizontal accuracy of the location updates. I believe this instance of CLLocationManager is separate from any you might start yourself, because I also run a CLLocationManager in parallel and don't see any interference from the map view's current location updates.

Therefore, if you don't want the MKMapView to run its own high accuracy location manager instance, then disable showsUserLocation and create and manually update your own current location MKAnnotationView based on your CLLocationManager's location updates. You can also zoom to the new updates as applicable.

I know this is essentially reinventing the wheel, but I believe it's the only way to get the functionality you want based on the tools Apple has provided. If anyone else knows otherwise, please chime in because I would also be interested.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!