I want to use a MKMapView to display the user current location using the default breathing blue pin and I want to record the user movement at the same time. Is there any way that I could use the GPS manager (not sure if this is a CLLocationManager) the MKMapView uses when we enabled it to show user location?
I know that I can create my own CLLocationManager. But this feels like adding an overhead to my application and I would like the map and my tracking to remain in sync.
I already explored the following ideas without success:
- Use the
[MKMapView showUserLocation:YES]
and add KVO on the userLocation
field. This does not work and I am wondering if this is due to the fact that the userLocation
field is read only.
- Use the
[MKMapView showUserLocation:YES]
, create a MKMapViewDelegate
and add the tracking when the annotation view for the user location is requested. This does not work, because the annotation view is apparently requested only once???
- Use a
CLLocationManager
and try to add the blue pin manually. Unfortunately, I did not find the blue pin in the available pin types, so I tried to create a user annotation manually without success.
Does anyone has any idea how I can achieve this and still benefit from the blue pin or is my only solution to use a CLLocationManager
and create my own pin?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…