Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2274] iOS: Map Annotation click event doesn't return correct clicksource

GitHub Issuen/a
TypeStory
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-08-10T16:49:03.000+0000
Affected Version/sRelease 5.2.0, Release 5.3.0
Fix Version/sBacklog
ComponentsMap
LabelsBNSF
ReporterAngel Petkov
AssigneeAngel Petkov
Created2016-07-15T23:35:54.000+0000
Updated2016-08-10T16:49:07.000+0000

Description

Demo Code:
var MapModule = require('ti.map');
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var appc = MapModule.createAnnotation({
    latitude: 37.389569,
    longitude: -122.050212,
    title: 'Appcelerator HQ',
    subtitle: 'Mountain View, CA',
    pincolor: MapModule.ANNOTATION_GREEN,
    draggable: true,
    rightButton: Ti.UI.iPhone.SystemButton.CONTACT_ADD
});
var mapview = MapModule.createView({
    mapType: MapModule.HYBRID_TYPE,
    region: {latitude: 37.389569, longitude: -122.050212, latitudeDelta: 0.2, longitudeDelta: 0.2},
    annotations: [appc]
});


mapview.addEventListener('click', function(e){
    Ti.API.info(e.type);
    Ti.API.info(JSON.stringify(e.clicksource));
});

win.add(mapview);
win.open();
*Test Case:* Click the Title or subTitle of the map annotation. *Expected Result:* Should return the title/subTitle as the clickSource *Actual Results* The returned clickSource is "pin"

Comments

  1. Angel Petkov 2016-07-26

  2. Ricardo Ramirez 2016-07-27

    [~apetkov] We need at least a workaround for this. Is possible for you to implement a view or to add some view instead the map annotation and attach the event to the view ?
  3. Angel Petkov 2016-07-27

    [~rramirez] Like I said above the mapView delegates deal with the annotation callbacks not the actual annotations -so there aren't many workarounds.- Even if you were to create an annotation with a customView and 2 labels for title and subtitle it still wouldn't work, as no callbacks are called on the view because the user-interactions are [disabled](https://docs.appcelerator.com/platform/latest/#!/api/Modules.Map.Annotation). *EDIT:* For now please use the right and left accessories.
  4. Hans Knöchel 2016-08-10

    PR for the docs-update merged. As described in detail above, newer iOS-versions do not allow to track the title and subtitle when clicking the infoWindow. If we would still want to do it, it would only be with private API-usage which is disallowed by Apple. People can still create their own infoWindow with their labels and get it from there. Thanks!

JSON Source