A wich módon tudnám hívni a funkció, amely automatikusan megnyílik időjelzésemhez (a cím, alcím, stb.), Ahelyett, hogy érintse meg a kommentár a mapview?
Automatikus „canShowCallOut” megjegyzés IPHONE
szavazat
4
2 válasz
szavazat 4
4
Végre MKMapViewDelegatemegbízottja;
végrehajtja - (MKAnnotationView *) mapView: (MKMapView *) mapView_ viewForAnnotation: (id <MKAnnotation>) annotation_;; például így:
- (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;
}
Itt található a pin után a térképen betöltése befejeződött:
- (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];
}
Ez a kód egy ingatlan nevű kommentár, amely megvalósítja MKAnnotation. Is, ez élteti a döngését is, de meg kell viszonylag magától értetődő.
HTH.
szavazat 3
3
Alfons válaszol a kérdésre, de ha keres, hogy pontosan mi automatikusan megnyitja a kiemelő, akkor ez a rész:
[mapView selectAnnotation:annotation animated:YES];













