Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12639] iOS: Titanium.Map.View Click event fired multiple times

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-02-12T00:23:14.000+0000
Affected Version/sRelease 2.1.4, Release 3.0.0, Release 3.1.0
Fix Version/sRelease 3.2.0, Release 3.2.1
ComponentsiOS
LabelsSupportTeam, parity
ReporterEduardo Gomez
AssigneeIngo Muschenetz
Created2013-02-08T18:18:15.000+0000
Updated2014-02-12T00:23:14.000+0000

Description

Issue

MapView click event is being fired multiple times in iOS only.

Runnable sample

Grab & run code below. Console output log event multiple times. If you monitor through out DDMS the event will be fired only once.
var thisView = Ti.UI.createView({
width:45,
height:45
});

var win = Ti.UI.createWindow();
 
var pin1 = Titanium.Map.createAnnotation({
    latitude:37.390749,
    longitude:-122.081651,
    title:"Appcelerator Headquarters",
    subtitle:'Mountain View, CA',
    pincolor:Titanium.Map.ANNOTATION_RED,
    animate:true,
    image: 'map-pin.png',
    pinImage:'map-pin.png',
    selectPinImage:'map-pin-selected.png'
});     
 
var pin2 = Titanium.Map.createAnnotation({
    latitude: 31.390749,
    longitude:-121.081651,
    title:"Other one",
    subtitle:'Mountain View, CA',
    pincolor: Titanium.Map.ANNOTATION_RED,
    animate:true,
    image: 'map-pin.png',
    pinImage:'map-pin.png',
    selectPinImage:'map-pin-selected.png'
});     
 
var pin3 = Titanium.Map.createAnnotation({
    latitude: 30.390749,
    longitude:-122.081651,
    title:"Other one",
    subtitle:'Mountain View, CA',
    pincolor: Titanium.Map.ANNOTATION_RED,
    animate:true,
    image: 'map-pin.png',
    pinImage:'map-pin.png',
    selectPinImage:'map-pin-selected.png'
});     
 
var mapView = Titanium.Map.createView({
    mapType: Titanium.Map.STANDARD_TYPE,
    animate:true,
    regionFit:true,
    userLocation: false,
    annotations: [pin1, pin2, pin3]
}); 
 
win.add(mapView);
win.open();

var selectedPin = null;

mapView.addEventListener('click', function(e) {
	
	if(e.clicksource === 'pin'){ 
		Ti.API.info(" e.clicksource: "+ e.clicksource);
		e.annotation.setImage(e.annotation.selectPinImage);
		if(selectedPin){
			selectedPin.setImage(selectedPin.pinImage);
			selectedPin = e.annotation;
		} else {
			selectedPin = e.annotation;
		}
	}
});

Additional details

The developer need to test different approaches yet where this issue makes difficult click event functionality.

Attachments

FileDateSize
map-pin.png2013-02-08T18:18:15.000+00002457
map-pin-selected.png2013-02-08T18:18:15.000+00002241

Comments

  1. jithinpv 2013-04-05

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
  2. Shak Hossain 2014-02-11

    This issue can't be reproduced with TISDK 3.2 or higher. Therefore, marking it as resolved.
  3. Wilson Luu 2014-02-12

    Closing issue as cannot reproduce. Tested on: Appcelerator Studio, build: 3.2.1.201402061120 SDK build: 3.2.1.GA CLI: 3.2.1 Alloy: 1.3.1 Xcode: 5.0.2 Devices: ipad air (7.0.3), iphone 4s (6.0.1)

JSON Source