Why Does rightButton Click on Annotation Sometimes get Reported Twice?
I'm working on an app that has annotations with a disclosure button for the rightButton to get more detail on that item. I noticed that the sub-window was opening twice, and eventually tracked the problem back to the fact that Titanium is firing the click event twice for that tap.
I fired up KitchenSink to see if it was something in my code, but it does the same thing for the Atlanta annotation in that app. Oddly, the Steve Jobs rightButton only fires the click event once. I'm not sure what difference between those annotations causes the different behavior, but would love to have a fix or workaround.
UPDATE: I did check the clicksource and had looked at the API. The clicksource is rightButton for both firings of the event. Here's the log from clicking once on the Atlanta rightButton in KitchenSink:
[INFO] MAPVIEW EVENT - you clicked on Atlanta, GA with click source = rightButton
[INFO] removing mountain view annotation
[INFO] MAPVIEW EVENT - you clicked on Atlanta, GA with click source = rightButton
[INFO] removing mountain view annotation
[INFO] ANNOTATION EVENT - you clicked on Atlanta? with click source = annotation
[INFO] MAPVIEW EVENT - you clicked on Atlanta? with click source = annotation
[INFO] removing mountain view annotation
You can see that the click event fires several times, two of which show the rightButton clicksource.
1 Answer
-
You'll want to check the
clicksource
property since the click might come from the annotation or the underlying view iteself. Check out the latest API docs for MapView