Note that there are some explanatory texts on larger screens.

plurals
  1. POViewForAnnotation is not being called
    text
    copied!<p>I am trying to make a map, where I can see my current location, and see what the street is called.</p> <p>so far, I am able to put a pin on my map, but for some reason, I am not getting the callout. and I have put a NSLog in my viewForAnnotation method, but it is not being called, so i wasn't able to test it.</p> <p>can someone help me?</p> <pre><code>-(void)lat:(float)lat lon:(float)lon { CLLocationCoordinate2D location; location.latitude = lat; location.longitude = lon; NSLog(@"Latitude: %f, Longitude: %f",location.latitude, location.longitude); //One location is obtained.. just zoom to that location MKCoordinateRegion region; region.center=location; //Set Zoom level using Span MKCoordinateSpan span; span.latitudeDelta=.005f; span.longitudeDelta=.005f; region.span=span; [map setRegion:region animated:TRUE]; //MKReverseGeocoder *geocoder=[[MKReverseGeocoder alloc] initWithCoordinate:location]; //geocoder.delegate=self; //[geocoder start]; if (cPlacemark != nil) { [map removeAnnotation:cPlacemark]; } cPlacemark=[[CustomPlacemark alloc] initWithCoordinate:location]; cPlacemark.title = mPlacemark.thoroughfare; cPlacemark.subtitle = mPlacemark.locality; [map addAnnotation:cPlacemark]; [cPlacemark release]; [mLocationManager stopUpdatingLocation]; } - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;)annotation { if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; // try to dequeue an existing pin view first if ([annotation isKindOfClass:[CustomPlacemark class]]){ MKPinAnnotationView *pinView=(MKPinAnnotationView *)[map dequeueReusableAnnotationViewWithIdentifier:@"customIdentifier"]; if (!pinView) { // if an existing pin view was not available, create one MKPinAnnotationView* cPinAnnoView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"customIdentifier"] autorelease]; cPinAnnoView.pinColor = MKPinAnnotationColorPurple; cPinAnnoView.animatesDrop = YES; cPinAnnoView.canShowCallout = YES; // Add button UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [leftButton addTarget:self action:@selector(annotationViewClick:) forControlEvents:UIControlEventTouchUpInside]; cPinAnnoView.leftCalloutAccessoryView = leftButton; } else { pinView.annotation = annotation; } return pinView; } return nil; </code></pre> <p>}</p> <p>Right now I have customized my viewForAnnotation to be like this. But I still can't get a callout from my pin and the pin remains red. But it should be purple of nothing at all</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload