Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15873] ios annotation not showing up if title is not set

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsannotation, map
Reporterluca capra
AssigneeUnknown
Created2013-11-15T10:34:04.000+0000
Updated2018-02-28T20:03:58.000+0000

Description

var a = Ti.Map.createAnnotation({ ... });

annotation.rightView = Ti.UI.createView({ ... });
// async code to populate the view

a.addEventListener("click", function(e) {  Ti.API.warn("ANNO clicked!");  });
mapView.addAnnotation(a);

mapView.addEventListener("click", function(e) { Ti.API.warn("MAP clicked!");  });

This code will not trigger click event on pin touch and the annotation will never open. Adding title (non empty value) will work as expected (annotation showing up).
annotation.setTitle(" ")
(from http://developer.appcelerator.com/question/159509/iphone-map-annotation-click-not-working)

Comments

  1. Mauro Parra-Miranda 2013-11-21

    Hello Luca! Please provide a full testcase so we can move this one to platform. TIA! Best, Mauro
  2. Mostafizur Rahman 2013-11-21

    This issue is reproducible with test code pasted below. Annotation is showing but ‘click’ event is not firing.

    My testing environment follows:

    OS: MAC OS X 10.8.5 Ti SDK: 3.1.3 GA Ti CLI: 3.2.0 IOS simulator 7.0

    My test code

       var win = Ti.UI.createWindow();
       
       var mountainView = Titanium.Map.createAnnotation({
       	latitude : 37.390749,
       	longitude : -122.081651, 
       	subtitle : 'Mountain View, CA',
       	pincolor : Titanium.Map.ANNOTATION_RED,
       	animate : true,
       	leftButton : '/images/appcelerator_small.png',
       	 });
       
       var mapview = Titanium.Map.createView({
       	mapType : Titanium.Map.STANDARD_TYPE,
       	region : {
       		latitude : 37.390749,
       		longitude : -122.081651,
       		latitudeDelta : 0.04,
       		longitudeDelta : 0.04
       	},
       	animate : true,
       	regionFit : true,
       	userLocation : true,
       	annotations : [mountainView]
       });
       
       win.add(mapview);
       // Handle click events on any annotations on this map.
       mountainView.addEventListener('click', function(evt) {
       
       	Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid);
       
       	alert(evt.clicksource);
       
       	// Check for all of the possible names that clicksouce
       	// can report for the left button/view.
       	if (evt.clicksource == 'leftButton' || evt.clicksource == 'leftPane' || evt.clicksource == 'leftView') {
       		Ti.API.info("Annotation " + evt.title + ", left button clicked.");
       	}
       });
       
       win.open();
       

    Step to reproduces

    1. Create a new project 2. Paste test code in app.js 3. Now run on iOS 7 with simulator 7.0 4. Click on annotation 5. Event will not fired Thanks

JSON Source