[英]Add and display MKOverlay when MKAnnotation has been tapped
Is possible to add an MKOverlay
when the user taps an MKAnnotation
? 用户点击
MKOverlay
时可以添加MKAnnotation
吗? Ie, what I want to achieve is when the user taps the annotation pin, I want to draw a polygon (a circle for example), and when the user taps again the overlay should hide. 即,我想要实现的是当用户点击注释图钉时,我想绘制一个多边形(例如,一个圆形),并且当用户再次点击时,覆盖图应该隐藏。
If annotation was tapped call function with adding overlay. 如果点击了注释,则调用函数并添加叠加层。 Use this in your code:
在您的代码中使用它:
[self.mapView addOverlay:self.circle];
for controll if annotation was tapped already, i would use BOOL variable in your interface: 对于controll,如果已经点击了注释,我将在您的界面中使用BOOL变量:
@interface ClassName() {
BOOL annotationWasTapped;
}
@end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.