मैं एक नक्शा (डिफ़ॉल्ट पिन के बजाय) का कस्टम चित्रों का प्रदर्शन कर रहा हूँ नीचे कोड का उपयोग कर। हालांकि, जब मैं एक आइटम पर नल (और कॉलआउट दिखाई देता है), छवि डिफ़ॉल्ट लाल पिन में बदल जाती। मैं अपने कस्टम छवि रख सकते हैं, भले ही कॉल आउट प्रदर्शित किया जाता है?
- (MKAnnotationView *) mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
MKPinAnnotationView *pinAnnotation = nil;
if (annotation != mapView.userLocation)
{
static NSString *pinID = @mapPin;
pinAnnotation = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:pinID];
if (pinAnnotation == nil)
pinAnnotation = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pinID] autorelease];
// Set the image
pinAnnotation.image = [UIImage imageNamed:@TestIcon.png];
// Set ability to show callout
pinAnnotation.canShowCallout = YES;
// Set up the disclosure button on the right side
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
pinAnnotation.rightCalloutAccessoryView = infoButton;
[pinID release];
}
return pinAnnotation;
[pinAnnotation release];
}













