1

可能重复:
MKPinannotation 详细信息披露按钮 - 呈现新视图

任何人都知道我如何在地图图钉上获得附件按钮(详细信息披露)并在其点击事件上发生一些事件。谢谢

4

2 回答 2

3

您可以使用以下方法将附件按钮添加到您的 pin:

yourPinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

当您单击附件按钮时,将调用此委托:

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view 
            calloutAccessoryControlTapped:(UIControl *)control
{
   //do your stuff here
}
于 2013-01-09T06:04:03.243 回答
0

如果你想要一些不同的然后做

        UIButton *DetailViewBtn = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        DetailViewBtn.tag = currentAnnotation.tag;

        [DetailViewBtn setTitle:currentAnnotation.title forState:UIControlStateNormal];
        [DetailViewBtn addTarget:self
                        action:@selector(annotationBtnPress:)
              forControlEvents:UIControlEventTouchUpInside];

        yourAnnotationView.rightCalloutAccessoryView = DetailViewBtn;  

和你的方法在这里

-(IBAction)annotationBtnPress:(id)sender
{
    NSLog(@"raj");
}
于 2013-01-09T07:05:27.397 回答