Hi all, i try to get this work, But is not remove the annotations.
mapview.removeAnnotations(cars); not working mapview.addAnnotation(cars); working
b1.addEventListener('click', function() { mapview.removeAnnotations(cars); b1.hide(); b1on.show(); }); b1on.addEventListener('click', function() { mapview.addAnnotation(cars); b1on.hide(); b1.show(); });
3 Answers
Is cars an array of annotations or not. You are using addAnnotation <-- singular to add the annotation, but then you are using removeAnnotations <-- plural to remove the same variable.
Assuming cars is a single annotation object, try either: mapview.removeAnnotation(cars); or mapview.removeAnnotations([cars]);
I have the same issue using Titanium 3.0 beta running on the iPad emulator (iOS 6.0). I get the desired result if I call mapview.removeAnnotations.apply(mapview, annotations) (where annotations is an array).
The documentation indicates that mapview.removeAnnotations is unavailable on Android, however. I wonder if fixing this bug would make it work on Android.
Your Answer
Think you can help? Login to answer this question!