次のコードを使用して、右のアクセサリ ボタンで注釈吹き出しを作成しています
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]]){
return nil;
}
else {
static NSString *AnnotationViewID = @"annotationViewID";
MKAnnotationView *annotationView = (MKAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];
if (annotationView == nil)
{
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID];
}
annotationView.image = [UIImage imageNamed:@"Mevents.png"];
annotationView.annotation = annotation;
annotationView.canShowCallout=YES;
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton setTitle:annotation.title forState:UIControlStateNormal];
[rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;
// UIImageView *profileIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"profile.png"]];
// pinView.leftCalloutAccessoryView = profileIconView;
// [profileIconView release];
return annotationView;
}
}
どの注釈がクリックされたかを追跡するにはどうすればよいですか? 詳細画面にIDをロードし、その ID に基づいてデータを取得して情報を表示したいと考えています。