Enabling the 'blue dot' which shows current location in my application by
mapView.showsUserLocation = YES
Disabling/hiding the dot by
mapView.showsUserLocation = NO
开发者_运维技巧
in order to drop a pin. So far so good.
Adding an annotation pin at 'userLocation' and dragging it around in the map to a new location. After that I want to show the blue dot again by setting showsUserLocation to YES again - but it simply does not show up! What could be the problem? Is there a way to force it to show again (reset userLocation?) with any other method? Which events are involved?
Grateful for any help on this one..
check if you are customizing your annotationView with - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
method try:
if (annotation==_mapView.userLocation ) {
return nil;
}
else {
//...
//costumizing pins for other annotations on mapview
//return customized annotationview
}
Try this:
if ([annotation isKindOfClass:[MKUserLocation class]]) return nil;
Using the class rather than annotation==_mapView.userLocation means that is you stop using _mapView.userLocation or whatever, this line does not break.
精彩评论