2

I Implementet this:

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

    MKPinAnnotationView *pinView = nil;

        static NSString *defaultPinID = @"Place to be";
        pinView = (MKPinAnnotationView *)[self.myMapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
        if ( pinView == nil ) pinView = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:defaultPinID];

        pinView.pinColor = MKPinAnnotationColorRed;
        pinView.canShowCallout = YES;
        pinView.animatesDrop = YES;


        UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [rightButton addTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
        pinView.rightCalloutAccessoryView = rightButton;

        return pinView;   
}

My problem now is that the Userlocation is shown a a Pin... How can i get back the blue dot?

Thanks

Craig
  • 8,093
  • 8
  • 42
  • 74
  • See this question and answer: http://stackoverflow.com/questions/11767240/how-to-stop-the-viewforannotation-method-from-overriding-the-default-user-locati – Craig Mar 10 '13 at 06:56

1 Answers1

1

try this

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

    if([annotation isKindOfClass: [MKUserLocation class]])
       return nil;


    MKPinAnnotationView *pinView = nil;

    static NSString *defaultPinID = @"Place to be";
    pinView = (MKPinAnnotationView *)[self.myMapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
    if ( pinView == nil ) pinView = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:defaultPinID];

    pinView.pinColor = MKPinAnnotationColorRed;
    pinView.canShowCallout = YES;
    pinView.animatesDrop = YES;


    UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [rightButton addTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
    pinView.rightCalloutAccessoryView = rightButton;

    return pinView;   
}
Aman Aggarwal
  • 3,754
  • 1
  • 19
  • 26