我想检测对注释引脚(mapkit
)的点击,以便我可以对该事件执行操作。
现在,如果我触摸注释引脚,就会弹出默认注释标志。我想自定义它以在触摸 pin 时调用我的方法。
最佳答案
您需要实现以下委托(delegate)方法
(MKAnnotationView) mapView viewForAnnotation:(id) annotation
然后只需在该方法中声明以下内容
MKPinAnnotationView *view=[[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:@"abc"];
view.canShowCallout=YES;
view.calloutOffset=CGPointMake(-20,10); //As per your choice
然后您可以将 UI 添加到标注中,例如 UIButton 或 UIImage 作为 view.rightCalloutAccessoryView View.leftCalloutAccesoryView
关于iphone - 如何检测 map 注释 Pin 上的点击?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5648169/