wich şekilde ben MapView üzerinde notu üzerine dokunmak yerine, (başlık, alt, vb) ile otomatik olarak benim ek açıklama açmak işlevi diyebiliriz?
Otomatik "canShowCallOut" ek açıklama IPHONE
oy
4
2 cevaplar
oy 4
4
Uygulama MKMapViewDelegatetemsilci;
uygulamak - (MKAnnotationView *) mapView: (MKMapView *) mapView_ viewForAnnotation: (id <MKAnnotation>) annotation_;; Böyle örneğin:
- (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;
}
harita yüklenmesi tamamlandıktan sonra pin göster:
- (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];
}
Bu kod uygulayan bir özellik olarak adlandırılan ek açıklama vardır MKAnnotation. Ayrıca, çok pim damla canlandıran, ancak oldukça kendini açıklayan olmalıdır.
HTH.
oy 3
3
Alfons soruyu yanıtladı ama pek otomatik ek bilginin açılır ne arıyorsanız, bu parçası:
[mapView selectAnnotation:annotation animated:YES];













