Benim iphone uygulamasında, ben MKMapView ve özel MKAnnotationView ile MapKit kullanıyorum.
ek açıklamalar (Uygulamamda, ek açıklamalar fotoğraflar ve bu fotoğrafların çakışabilir) harita üzerinde üst üste ve ön yüzünde görünen notu üzerine dokunun, bu olayı alır (arkasında) Başka bir ek açıklama var ne zaman sorunudur (rasgele gibi görünüyor ).
Ön ek nota olayı göndermek için herhangi bir şekilde bulamadık. Bu hata / sorun herhangi bir çözüm yok inanamıyorum!
Z sipariş ve ek açıklamalar örtüşen al o kadar bana yardım etmedi stackoverflow sorular.
bir fikrin karşılama (hatta kirli çözümler) 'dir edin!
İşte benim kod (fantezi şey, çok yaygın) bazıları aşağıda verilmiştir:
CustomAnnotation.h
@interface CustomAnnotation : NSObject <MKAnnotation> {
@private
CustomAnnotationView* view;
}
@property (nonatomic, retain) CustomAnnotationView* view;
@end
CustomAnnotation.m
@implementation CustomAnnotation
@synthetize view;
CustomAnnotationView.h
@interface CustomAnnotationView : MKAnnotationView {
}
@end
CustomAnnotationView.m
@implementation CustomAnnotationView
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
// Do something related to the annotation tapped
}
@end
Ana sınıfı ... // Açıklamalar eklenir ve bazıları diğerleri ile örtüşmektedir.
- (void)addAnnotation:(CustomAnnotation*)annotation {
[map addAnnotation:annotation];
}
...
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
NSString* identifier = getIdentifierFromAnnotation(annotation);
CustomAnnotationView* view;
if(!(view = (CustomAnnotationView*)[map dequeueReusableAnnotationViewWithIdentifier:identifier])) {
view = [[CustomAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier: identifier];
[(CustomAnnotation*)annotation setView:view];
[view release];
}
return view;
}













