可能重复:
MKPinannotation detail disclosure button - present new view
任何一个人都知道我如何在地图引脚上获得一个附件按钮(详细信息披露)并在其点击事件上有一些事件。 谢谢
答案 0 :(得分:3)
您可以使用以下方法将辅助按钮添加到您的引脚:
yourPinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
当您点击附件按钮时,将调用此委托:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
//do your stuff here
}
答案 1 :(得分: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");
}