2010-09-10 19 views
13
Aşağıdaki kod ile özel açıklama görüntüleri çekmek için MapKit yeteneğini artırdık

:Genişletilmiş MapView: viewForAnnotation Şimdi Yok Mavi Nokta

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{ 
    NSLog(@"Drawing a cloud on the map"); 
    MKAnnotationView *view; 
    if(annotation != mapView.userLocation){ 
     view=[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"parkingloc"]; 
     view.image=[UIImage imageNamed:@"placemarkCloud.png"]; 
     [view setCanShowCallout:YES]; 
     [view setRightCalloutAccessoryView:[UIButton buttonWithType:UIButtonTypeDetailDisclosure]]; 
    } 
    else{ 
     view= 
    } 
    return view; 
} 

Sorum ben iPhone'un dahili korumak için hiç = görünüm yapmak gereken budur mavi nokta. Özel resmimin nokta için çizildiğini yok ettiğimi görebilirsiniz, ancak varsayılan olarak nasıl gösterileceğini bilmiyorum.

cevap

47

Başka hiçbir şey koymayın. Aşağıdaki kontrolü yapıyorum. Bunun Apple örnek kodundan türetilmiş olduğunu düşünüyorum.

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

if ([annotation isKindOfClass:[MKUserLocation class]]) { 
    //Don't trample the user location annotation (pulsing blue dot). 
    return nil; 
} 

//Continue on to your regular code here. 
İlgili konular