不要删除我地图上的所有注释
Do not remove all annotations on my map
我有这个按钮,应该 show/hide 我的地图上的某些注释图钉。我在下面有这个功能,但是当你按下它来移除引脚时,它会移除所有引脚。它应该只删除 addAttractionPinsBilka 内的引脚?我该怎么做才能实现这一目标?
这是我的代码:
@IBAction func bilkaAction(sender: AnyObject) {
if !annotationBilkaIsVisible {
addAttractionPinsBilka()
annotationBilkaIsVisible = true
}else {
map.removeAnnotations(map.annotations)
annotationBilkaIsVisible = false
}
}
希望你能帮助我:-)
假设您在 addAttractionPinsBilka()
中添加的注释类型为 Artwork
以下代码删除该类型的所有注释
for annotation in map.annotations where annotation is Artwork {
map.removeAnnotation(annotation)
}
我有这个按钮,应该 show/hide 我的地图上的某些注释图钉。我在下面有这个功能,但是当你按下它来移除引脚时,它会移除所有引脚。它应该只删除 addAttractionPinsBilka 内的引脚?我该怎么做才能实现这一目标?
这是我的代码:
@IBAction func bilkaAction(sender: AnyObject) {
if !annotationBilkaIsVisible {
addAttractionPinsBilka()
annotationBilkaIsVisible = true
}else {
map.removeAnnotations(map.annotations)
annotationBilkaIsVisible = false
}
}
希望你能帮助我:-)
假设您在 addAttractionPinsBilka()
中添加的注释类型为 Artwork
以下代码删除该类型的所有注释
for annotation in map.annotations where annotation is Artwork {
map.removeAnnotation(annotation)
}