Benutzer anzeigen Standort blauer Punkt im iPhone MKMapView

Ich bin bei der Entwicklung einer benutzerdefinierten pins in einer MapView in meiner iPhone app.
Hier ist der code:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id  <MKAnnotation>)annotation
 {
     static NSString *AnnotationViewID = @"annotationViewID";

     MKAnnotationView *annotationView = (MKAnnotationView *)[myMapView  dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];

     if (annotationView == nil)
     {
         annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
     }

    if ([[annotation title] isEqualToString:NSLocalizedString(@"Current Location",@"")])  {

        MKPinAnnotationView *pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
        //pin.pinColor = MKPinAnnotationColorRed;
        annotationView = pin;
    }
    else
    {
        NSString *pin = [NSString stringWithFormat:@"pin%i.png",[[annotation imgNumber] intValue]];
        annotationView.image = [UIImage imageNamed:pin];//Canviar la chincheta per numero
        UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [annotationView setRightCalloutAccessoryView:button];
        annotationView.annotation = annotation;
        annotationView.canShowCallout = YES;

    /********* Imagen a la izquierda en la burbuja *********/
    annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
    //Set up the Left callout
    UIButton *myDetailButton = [UIButton buttonWithType:UIButtonTypeCustom];
    myDetailButton.frame = CGRectMake(0, 0, 23, 23);
    myDetailButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    myDetailButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;

    //Set the image for the button
    //[myDetailButton setImage:[UIImage imageNamed:@"botocorreu.png"] forState:UIControlStateNormal];
    NSString *detailButton = [NSString stringWithFormat:@"%i",[[annotation imgNumber] intValue]];
    [myDetailButton setImage:[UIImage imageNamed:detailButton] forState:UIControlStateNormal];  
    //Set the button as the callout view
    annotationView.leftCalloutAccessoryView = myDetailButton;
    annotationView.canShowCallout = YES;
    }
     return annotationView;
  }

Dies funktioniert gut, aber zeigen Sie mir die Benutzer-Position mit einem roten Stift.
Ich check die "show-user-Standort" in der IB.
ich würde gerne die Standard-blauen Punkt bewegen wird, es automatisch, wenn der Benutzer in Bewegung ist, ist das nicht richtig?
Wie kann ich das tun?

Vielen Dank.

Schreibe einen Kommentar