Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Deselecting all annotations

Is there a way to do that? if i remove all the annotations, and add new ones - selected one still appears. So is there a way to deselect the annotations before removing them?

— asked November 15th 2010 by Filip Dimitrovski
  • android
  • bug
  • deselect
  • mobile
0 Comments

3 Answers

  • Accepted Answer

    Try yourmapview.deselectAnnotation(annotationObject) where yourmapview is your map view and annotationObject is a reference to the annotation object (not index or title).

    — answered November 15th 2010 by Tim Poulsen
    permalink
    1 Comment
    • But , i use the same variable for all the annotation instances i create… for example:

      for(i=0;i<10;i++){
      variab=Titanium.Map.createAnnotation({code here}});
      mapview.add(variab);
      }
      

      Is there a way , to add all the annotations in a array , and with for loop , to open all them - and deselect them ?

      — commented November 16th 2010 by Filip Dimitrovski
  • — answered November 15th 2010 by Filip Dimitrovski
    permalink
    0 Comments
  • problem solved… in the beginning:

    var anotacii=new Array();
    

    in the loop:

    anotacii.push(pin);
    

    on the end:

    for(i=0;i<anotacii.length;i++){
    mapview.deselectAnnotation(anotacii[i]);
    }
    
    — answered November 16th 2010 by Filip Dimitrovski
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.