Note that there are some explanatory texts on larger screens.

plurals
  1. POiPad MapKit - Reselecting one pin does not work
    primarykey
    data
    text
    <p>I have the following problem:</p> <p>I have a number of pins on my map. After touching one, a custom popup opens and displays information. This works perfect.</p> <p>My problem is, that if you select the same pin twice, the popups does not open, you have to touch another one or click some where in the map.</p> <p>My code is the following:</p> <pre><code>- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;) annotation{ MKAnnotationView* annotationView = nil; CPPointOfInterest *myAnnotation = (CPPointOfInterest*) annotation; if ([myAnnotation isKindOfClass:[MKUserLocation class]] || myAnnotation.poi_id &lt;= 0) { return nil; } else { NSString* identifier = @"Pin"; MKPinAnnotationView* annView = (MKPinAnnotationView*)[mv_map dequeueReusableAnnotationViewWithIdentifier:identifier]; if(nil == annView) { annView = [[[MKPinAnnotationView alloc] initWithAnnotation:myAnnotation reuseIdentifier:identifier] autorelease]; } [annView addObserver:self forKeyPath:@"selected" options:NSKeyValueObservingOptionNew context:@"GMAP_ANNOTATION_SELECTED"]; if(self.nearest_poi == myAnnotation) { annView.pinColor = MKPinAnnotationColorGreen; } else { annView.pinColor = MKPinAnnotationColorRed; } annView.animatesDrop = YES; annotationView = annView; [annotationView setEnabled:YES]; [annotationView setCanShowCallout:NO]; return annotationView; } } </code></pre> <p>Observer:</p> <pre><code>- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ NSString *action = (NSString*)context; if([action isEqualToString:@"GMAP_ANNOTATION_SELECTED"]){ BOOL annotationAppeared = [[change valueForKey:@"new"] boolValue]; if (annotationAppeared) { // show popup } } } </code></pre> <p>I have also tried the didSelectAnnotationView methode, this also just works for the first click event.</p> <p>I have searched for several hours, but nothing to find... :/</p> <p>Does anybody knows a solution for my problem, please give me a hint...</p> <p>Thanks and greetings, Mathew</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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