Take the 2-minute tour ×

I have 3 chekbox on the mapview on the click of any check mark the pin plotted of that checked box , but when I uncheck that box the pins should be removed but they are not. so How can I remove pins when unchecking the box?

And removing like this: [_gogoZingMap removeAnnotations:NearbyPeopleArr]; but it doesn't work.

Help me to remove the pins from map which are unselected. Thanks in Advance

share|improve this question
add comment

1 Answer

There are a few ways of going about this, and it is dependent on the way you have implemented you map.

I assume that NearbyPeopleArr is an annotation that conforms to the MKAnnotation protocol.

From that you describe, it sounds as if you have a list of annotations, and you want to display only the ones that are selected by the user. Therefore, you have 2 options:

  1. Reload the array of annotations every time one is selected or de-selected. This may be slower, but it has the effect of allowing all the pins to animate again, which may or may not be beneficial.

  2. Remove or add the specific annotation in the index of the array every time one is selected or de-selected. This is faster, and has the effect of animating only the annotation that is being selected or de-selected.

For option 1, you would use the addAnnotations: and removeAnnotations: methods, and provide them with the newly formatted array based on the selection by the user.

For option 2, you would use the addAnnotation: and removeAnnotation: methods, and provide them with the specific annotation you want to manipulate based on the selection by the user.

That's about all I can really offer without seeing any code. Hope that helps!

share|improve this answer
add comment

Your Answer


