Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15545] iOS7: Clicking on map view annotation does not fire event

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2013-11-05T22:14:11.000+0000
Affected Version/sRelease 3.1.3
Fix Version/sn/a
ComponentsiOS
LabelsSupportTeam, triage
ReporterIan Tearle
AssigneeRitu Agrawal
Created2013-10-15T08:30:49.000+0000
Updated2017-03-23T05:23:50.000+0000

Description

When adding an annotation to a map you expect to be able to click on a pin, then receive a click event for the annotation itself. What actually is seen, clicking on a pin displays the annotation. Clicking on the annotation does nothing. With the annotation open, clicking anywhere outside of the annotation fires the clicksource of the annotation and closes the annotation. Clicking inside the annotation should fire the event. Not the other way around. Run this simple app.js
 
var win = Ti.UI.createWindow();

var mountainView = Titanium.Map.createAnnotation({
    latitude:37.390749,
    longitude:-122.081651,
    title:"Appcelerator Headquarters",
    subtitle:'Mountain View, CA',
    pincolor:Titanium.Map.ANNOTATION_RED,
    animate:true,
    leftButton: '../images/appcelerator_small.png',
    myid:1 // Custom property to uniquely identify this annotation.
});

var mapview = Titanium.Map.createView({
    mapType: Titanium.Map.STANDARD_TYPE,
    region: {latitude:37.390749, longitude:-122.081651,
            latitudeDelta:0.04, longitudeDelta:0.04},
    animate:true,
    regionFit:true,
    userLocation:true,
    annotations:[mountainView]
});

win.add(mapview);
// Handle click events on any annotations on this map.
mapview.addEventListener('click', function(evt) {

    Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid);

    alert(evt.clicksource);

    // Check for all of the possible names that clicksouce
    // can report for the left button/view.
    if (evt.clicksource == 'leftButton' || evt.clicksource == 'leftPane' ||
        evt.clicksource == 'leftView') {
        Ti.API.info("Annotation " + evt.title + ", left button clicked.");
    }
});

win.open();

Comments

  1. Ian Tearle 2013-10-24

    Are there any patches I can make in the mean time? This bug is preventing further development and subsequently delaying a release, which is awkward.
  2. Adam Paxton 2013-10-24

    Ian, as a workaround, I attached an click event listener to the individual annotations.
  3. Ian Tearle 2013-10-24

    Really, because I have found that doing so has the same result as above, the only event that is fired is that for leftButton/rightButton - no clicksource for title, subtitle, left/rightView.
  4. Adam Paxton 2013-10-24

    Correct, I had to add a button instead of depending on a title/subtitle click, but was better than getting no event from the bubble.
  5. Lee Morris 2017-03-23

    Closing ticket as duplicate with reference to the linked issues above.

JSON Source