Automatikus „canShowCallOut” megjegyzés IPHONE

szavazat
4

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?

A kérdést 20/03/2010 17:36
a forrás felhasználó
Más nyelveken...                            


2 válasz

szavazat
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.

Válaszolt 21/03/2010 21:47
a forrás felhasználó

szavazat
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]; 
Válaszolt 10/01/2012 05:09
a forrás felhasználó

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more