Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8309] iOS: Ti.Map.Annotation event listeners don't fire consistently

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2012-03-28T13:26:56.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterJunaid Younus
AssigneeNeeraj Gupta
Created2012-03-26T12:08:13.000+0000
Updated2012-04-04T09:29:23.000+0000

Description

*Code*
var win1 = Titanium.UI.createWindow({
	title:'Tab 1', 
	backgroundColor:'#fff' 
});

var mapView = Ti.Map.createView({ 
	top : 0, 
	left : 0, 
	right:0, 
	bottom:0, 
	mapType : Titanium.Map.STANDARD_TYPE, 
	animate : true, 
	regionFit : true, 
	userLocation : true 
});

for (var i = 0; i < 10; i++) 
{
	var v = Ti.UI.createView({ 
		width:50, 
		height:30 
	}); 
	
	var link = Ti.UI.createLabel({ 
		text:"HI", 
		width:50, 
		height:30, 
		backgroundColor:"white" 
	}); 
	
	link.addEventListener('click',function(e) 
	{ 
		Ti.API.info("Clicked Right View Label on Annotation"); 
	}); 
	
	v.add(link);
	
	var annotationTick = Titanium.Map.createAnnotation({
	    latitude : 0,
	    longitude : i*10,
	    title : "Title",
	    subtitle : "Subtitle",
	    pincolor : Titanium.Map.ANNOTATION_GREEN,
	    animate : true,
	    rightView: v
	});
	
	annotationTick.addEventListener('click',function(e)
	{
	    Ti.API.info("Clicked Annotation");
	});
	
	mapView.addAnnotation(annotationTick);
}

win1.add(mapView);

win1.open();
*Expected behavior* When you click on each annotation, it should print out to the console that the event has been fired. Also when you tap on the white label, it should also print/fire another event that shows the label has been tapped. *Actual behavior* Events don't seem to fire at all, unless you tap on the last pin. If you tap on the last pin, the event gets fired instantly, the next event will also work fine, however any after that don't seem to fire at all again. So in other words, you tap the last pin, then you can tap any other pin and it will fire the events. But after that, it won't fire any events again, unless you tap the last pin again. *Notes* -Only tested with 1.8.2 with the iOS 5.0 simulator. -Zoom out from the map view in order to see the pins. -HD ticket: http://support-admin.appcelerator.com/display/APP-436565

Comments

  1. Dustin Hyde 2012-03-28

    Closing as Fixed. SDK: 2.0.0.v20120326211803 Studio: 2.0.0.201203271933 OS: Snow Leopard Devices Tested: iPhone Simulator 5.0
  2. Junaid Younus 2012-03-28

    Would it be possible to add this to 1.8.2 please?
  3. Neeraj Gupta 2012-03-28

    Duplicate of TIMOB-7396.

JSON Source