[TIMOB-8864] iOS: mapView - listen for clicks and longpress on the mapview
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 1.8.2, Release 2.0.1 |
Fix Version/s | n/a |
Components | iOS |
Labels | api |
Reporter | Jon Alter |
Assignee | Unknown |
Created | 2012-04-23T13:43:10.000+0000 |
Updated | 2018-02-28T20:03:13.000+0000 |
Description
Requesting click/longpress events on the mapView to return the latitude and longitude of the location that was pressed.
Steps to reproduce
Step 1: run the code below Step 2: click somewhere on the map Step 3: once this is working the event should contain the lat and long of the location on the map that was clicked Currently: the click doesn't fire unless you click on the annotation and longpress does fire but it does not return the lat and long of the event. There is a module in the marketplace that does this, but it should be included in the sdk. https://marketplace.appcelerator.com/apps/1334
var win = Ti.UI.createWindow();
win.open();
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,
});
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
animate:true,
regionFit:true,
userLocation:true,
annotations:[mountainView]
});
win.add(mapview);
mapview.addEventListener('click', function(evt) {
Ti.API.info('click');
Ti.API.info(evt);
});
mapview.addEventListener('longpress', function(evt) {
Ti.API.info('longpress');
Ti.API.info(evt);
});
In addition to this. No event, even longpress, is possible when using Mapview in android development. I do not care about the returning of the lat and long, sorry but 99 cents is not scaring me.