În mod as putea apela CARE funcția care se deschid automat adnotare mea (cu titlu, subtitlu, etc.), mai degrabă decât să se atingă pe adnotarea de pe mapview?
Automată „canShowCallOut“ IPHONE adnotare
voturi
4
2 răspunsuri
voturi 4
4
Punerea în aplicare a MKMapViewDelegatedelegat;
Punerea în aplicare - (MKAnnotationView *) mapView: (MKMapView *) mapView_ viewForAnnotation: (id <MKAnnotation>) annotation_;; de exemplu , ca aceasta:
- (MKAnnotationView *) mapView: (MKMapView *) mapView_ viewForAnnotation: (id <MKAnnotation>) annotation_ {
MKPinAnnotationView *pin = (MKPinAnnotationView *) [self.mapView dequeueReusableAnnotationViewWithIdentifier: @"YourPinId"];
if (pin == nil) {
pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation_ reuseIdentifier: @"YourPinId"] autorelease];
}
else {
pin.annotation = annotation_;
}
pin.pinColor = MKPinAnnotationColorRed;
[pin setCanShowCallout:YES];
pin.animatesDrop = YES;
return pin;
}
Arată PIN-ul după hartă a terminat de încărcare:
- (void) dropPin {
[mapView addAnnotation:self.annotation];
[mapView selectAnnotation:self.annotation animated:YES];
}
- (void) mapViewDidFinishLoadingMap: (MKMapView *) mapView_ {
// if done loading, show the call out
[self performSelector:@selector(dropPin) withObject:nil afterDelay:0.3];
}
Acest cod are o adnotare proprietate numită care pune în aplicare MKAnnotation. De asemenea, animă meniurile PIN - ul prea, dar ar trebui să fie destul de auto - explică.
HTH.
voturi 3
3
Alfons a răspuns la întrebarea, dar dacă sunteți în căutarea pentru ce anume se deschide automat înștiințarea, este această parte:
[mapView selectAnnotation:annotation animated:YES];













