[MOD-2274] iOS: Map Annotation click event doesn't return correct clicksource
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-10T16:49:03.000+0000 |
Affected Version/s | Release 5.2.0, Release 5.3.0 |
Fix Version/s | Backlog |
Components | Map |
Labels | BNSF |
Reporter | Angel Petkov |
Assignee | Angel Petkov |
Created | 2016-07-15T23:35:54.000+0000 |
Updated | 2016-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"
[~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 ?
[~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.
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!