Αυτόματη «canShowCallOut» IPHONE σχολιασμό

ψήφοι
4

Σε διασκορπισμένες τρόπο θα μπορούσα να καλέσετε τη λειτουργία που ανοίγουν αυτόματα σχολιασμό μου (με τον τίτλο, υπότιτλο, κλπ), αντί να αγγίξει το σχολιασμό στο MapView;

Δημοσιεύθηκε 20/03/2010 στις 17:36
πηγή χρήστη
Σε άλλες γλώσσες...                            


2 απαντήσεις

ψήφοι
4

Εφαρμογή MKMapViewDelegateεκπρόσωπος?

Εφαρμογή - (MKAnnotationView *) mapView: (MKMapView *) mapView_ viewForAnnotation: (id <MKAnnotation>) annotation_;? για παράδειγμα όπως αυτό:

    - (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;
}

Δείτε το pin μετά ο χάρτης έχει ολοκληρωθεί η φόρτωση:

- (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];
}

Αυτός ο κώδικας έχει μια ιδιότητα που ονομάζεται σχολιασμό που υλοποιεί MKAnnotation. Επίσης, ζωντανεύει την καρφίτσα να πέφτει πάρα πολύ, αλλά θα πρέπει να είναι αρκετά αυτο-εξήγηση.

HTH.

Απαντήθηκε 21/03/2010 στις 21:47
πηγή χρήστη

ψήφοι
3

Alfons απαντά στην ερώτηση, αλλά αν ψάχνετε για το τι ακριβώς αυτόματα ανοίγει την επεξήγηση, είναι αυτό το μέρος:

[mapView selectAnnotation:annotation animated:YES]; 
Απαντήθηκε 10/01/2012 στις 05:09
πηγή χρήστη

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