Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15448] iOS: No event generated on click of map annotation title or subtitle

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2015-08-13T03:09:26.000+0000
Affected Version/sRelease 3.2.0, Release 3.2.1, Release 3.2.3
Fix Version/sn/a
ComponentsiOS
Labelsios7, qe-3.2.1
ReporterMostafizur Rahman
AssigneeEric Merriman
Created2013-10-09T08:27:02.000+0000
Updated2017-03-29T22:04:21.000+0000

Description

Problem

When clicking on an annotation in a mapview, no event is generated for SDK 7.x/8.x but it’s working well for SDK 6.1. For more details visit http://developer.appcelerator.com/question/157471/mapview-click-event-listener-not-working-ios7

Test Code

var win2 = Ti.UI.createWindow({
	barColor : '#ff0000',
	extendEdges : [Ti.UI.EXTEND_EDGE_ALL],
});

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,
	leftButton : '/images/arrow.png',
	myid : 1 // Custom property to uniquely identify this annotation.
});

var mapview = Titanium.Map.createView({
	mapType : Titanium.Map.STANDARD_TYPE,
	region : {
		latitude : 37.390749,
		longitude : -122.081651,
		latitudeDelta : 0.01,
		longitudeDelta : 0.01
	},
	animate : true,
	regionFit : true,
	userLocation : true,
	annotations : [mountainView]
});

win2.add(mapview);
// Handle click events on any annotations on this map.
mapview.addEventListener('click', function(evt){
    var clicksource = evt.clicksource;
    
    alert(clicksource);
    if (clicksource == 'title' || clicksource == 'rightButton'){  
        Ti.API.info('Item clicked');                           
    }
});

win2.open();

Steps to reproduce

Please follow my steps to reproduce this bug:-

Create new project

Replace app.js code to my test code

Run with IOS SDK 6.1

Click on annotation pin. Annotation appears with title and subtitle

Click on title or subtitle

Its shows alert message

Now change to iOS SDK 7.x/8.x and follow steps 4 to 6

For iOS 7/8, if you click on title or subtitle, alert message will not display

Comments

  1. Aaron K. Saunders 2013-10-30

    So is this a bug that is going to be fixed anytime soon? hard to determine from the comments here... is there a workaround suggested.
  2. Ingo Muschenetz 2013-10-30

    [~aaron@clearlyinnovative.com] We are investigating and will let you know an approximate ETA.
  3. Adam Paxton 2013-10-30

  4. Vishal Duggal 2013-11-05

    The basic problem is how mapView fires the click event. On iOS it is fired when the annotation is selected or deselected, not when you click somewhere on the map. On iOS7 clicking on an annotation that is selected does not deselect the annotation (as it does on older versions of iOS). Hence it does not fire the click event. To fix this we would actually have to break existing behavior and redefine the events supported by the mapView. Right now as a workaround please use the leftbutton or rightbutton properties of the annotation and listen to the click event with the appropriate clicksource. We will address this in the next release.
  5. Varun Joshi 2013-11-26

    Is there any progress on this issue? We require this feature for a customer's app.
  6. Ingo Muschenetz 2013-11-26

    [~vjoshi] Apologies, not yet. It will be addressed in version 3.3.0 of the SDK.
  7. Wilson Luu 2014-02-04

    Issue is still reproducible on iOS 7. Tested on: Appcelerator Studio, build: 3.2.1.201401311225 SDK build: 3.2.0.GA, 3.2.1.v20140203160859 CLI: 3.2.1-beta3 Alloy: 1.3.1-cr Xcode: 5.0.2 Device: ipad 2 (7.0.4)
  8. Ingo Muschenetz 2014-05-06

    After investigation, this has more side effects than we previously thought. We need to move this to the next release. In the meantime, use the workarounds as suggested by Vishal.
  9. Fokke Zandbergen 2015-06-25

    Still an issue in 4.0.0.GA. No events fired when you tap on the title, subtitle, leftButton/View or rightButton/View. Simple example: https://gist.github.com/FokkeZB/1d2c98867f621798a5fa
  10. Chee Kiat Ng 2015-08-13

  11. Adam Paxton 2015-08-13

    TIMOB-19215 doesn't appear to be available publicly. Is there a way for the 16 or so non appc-employees watching this ticket to be able to track the new one?
  12. Aaron K. Saunders 2015-08-13

    this issue has been going on two years? and now we cannot track it any longer...
  13. Fokke Zandbergen 2015-08-13

    [~aaron@clearlyinnovative.com] [~adampax] it has been resolved and I've asked for the ticket to be made public.
  14. Nikita Radaev 2015-08-18

    There is still an issue with click event detection for "title" element. Tested on Iphone 6 with Ti.MAP version 2.3.3. and Titanium v 4.1.0 GA. Update: leftPane and leftView element clicks also dont throw events.
  15. Adam Paxton 2015-08-18

    [~nradaev] The new ticket TIMOB-19215 says the issue has been resolved in SDK 4.1.1. You will need to wait until 4.1.1 is released or test with a [continuous build](http://docs.appcelerator.com/platform/latest/#!/guide/Installing_Titanium_SDK_Continuous_Builds)
  16. Nikita Radaev 2015-08-18

    Retested with 4.1.1 v20160816214204 and confirmed that issues described in my comment above +still present+.
  17. Adam Paxton 2015-08-18

    You may want to post your findings on that ticket as well.
  18. Lee Morris 2017-03-29

    Closing ticket as duplicate, with reference to the above link, which was fixed in August 2015.

JSON Source