MapKit blue dot not showing when using custom annotations

I can't see the point of the current Blue location when I use custom annotations

- (MKAnnotationView *) mapView:(MKMapView *) mapView viewForAnnotation:(id<MKAnnotation> ) annotation {

    MKAnnotationView *customAnnotationView=[[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil] autorelease];

    UIImage *pinImage = [UIImage imageNamed:@"ann.png"];
    [customAnnotationView setImage:pinImage];

    customAnnotationView.canShowCallout = YES;
                                                                                                 
    //UIImageView *leftIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ann.png"]];
    //customAnnotationView.leftCalloutAccessoryView = leftIconView;

    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
    customAnnotationView.rightCalloutAccessoryView = rightButton;

    return customAnnotationView;
}
+3
source share
3 answers
if (annotation == map.userLocation) {
        return nil;
    }

Add this.: D

+8
source

Now I got the answer. You just need to add the following lines to the above code at the end before return customAnnotationView;

if (annotation == mapView.userLocation) {
NSLog (@ "zero"); return nil; }

thank:)

+2
source

" " . , showsUserLocation MKMapView YES. :

yourMapView.showsUserLocation = YES;

[yourMapView showsUserLocation] = YES;

, , MapKit : UserLocation - Apple , , . .


:

, , "" , , , , . :

if ([annotation isKindOfClass:[MapLocation class]]) {

}

MapLocation .

+1
source

Source: https://habr.com/ru/post/1786640/


All Articles