[TIMOB-1104] Map click events

GitHub Issuen/a
Resolution Date2011-05-11T17:43:07.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.0, Sprint 2011-13
Labelsclick, defect, events, ios, mapview, release-1.7.0, reported-1.6.0, requires-4.0, rplist
AssigneeReggie Seagraves


Ok, it seems that a map view looses its click event listener after the location changes. The attached project demonstrates this.




  1. Curtis Olson 2011-04-15

    I had a similar problem where I wasn't able to get any events on a map view. A child view added to a map view would get a click event, but not the map view itself. I documented this behavior here.

    http://developer.appcelerator.com/question/32451/mapview-ignoring-touchstart-event"> http://developer.appcelerator.com/question/32451/mapview-ignoring-t...

  2. Stephen Tramer 2011-04-15

    This is a duplicate bug and should have been fixed, but I cannot get the provided test to work. A simpler test needs to be provided. Map views do not receive click events except when a pin is selected.

    I am unable to duplicate the behavior and I believe this was fixed as part of an earlier map view bug. Leaving open until I can confirm this.

  3. Stephen Tramer 2011-04-15

    Still waiting on a simpler example.

  4. Nolan Wright 2011-04-15

    run Map View test in KS - click on map - no logging occurs (click event is not fired)

  5. Blain Hamon 2011-04-15

    Pushing out again.

  6. Dawson Toth 2011-04-15

    A pro client is interested in this fix now as well.

    Sample Code

    The following demonstrates the problem. Click on the annotation, and you will see the map's click event fires and an alert is shown. Click anywhere else, and nothing will happen.

       var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
       var map = Titanium.Map.createView({
           annotations: [Titanium.Map.createAnnotation({
               latitude: 37.390749, longitude: -122.081651,
               title: 'You Clicked Me!'
           region: {
               latitude: 37.390749, longitude: -122.081651,
               latitudeDelta: 0.01, longitudeDelta: 0.01
       map.addEventListener('click', function () {
           alert('Map Clicked!');

    Associated Helpdesk Ticket


  7. Jeff Haynie 2011-04-15

    (from [5facf6d39cd9f693da29eab4548a651bf3f3f77d]) [#1104] Fix to provide click-on/click-off for user-defined annotations. https://github.com/appcelerator/titanium_mobile/commit/5facf6d39cd9f693da29eab4548a651bf3f3f77d"> https://github.com/appcelerator/titanium_mobile/commit/5facf6d39cd9...

  8. Stephen Tramer 2011-04-15

    A full fix for this actually requires a guarantee of iOS 3.2+ running on device. Extensive research has shown that Apple does not provide a way to intercept events on a map view in 3.1.x without using undocumented classes or features.

    The previous commit is a slap patch to ensure that it is possible to detect when somebody "clicks off" an annotation. This can be done by checking the "source" property.

  9. Stephen Tramer 2011-04-15

    Forgot to mark "in-progress" as well. A full fix will be provided if possible.

  10. Stephen Tramer 2011-04-15

    Slap patch addresses customer issue. Going to bump the remainder of the bug (generic 'click' events) to TBS 1.7 so that we can discuss with the Android team about whether or not to break them and replace the name with something much more sensible.

  11. Stephen Tramer 2011-04-15

    Had a brief conversation with Marshall, we have parity on iOS and Android (only detect clicks on map overlays, i.e. pins and annotations). iOS has the addition of checking to see if you click OFF of either of these things and back on the map because that was a feature request.

    So, consider this resolved for iOS. We will not support general/generic 'click' events on the map.

  12. mikantchap 2011-04-15

    On Android, I don't see the click event firing if the background of the annotation is clicked.

    Using this code, you might see 'title' in the info message (if you actually click the title element) but you won't see 'annotation'. The reason this is important is because a user might fail to click through to another page if they happen to miss one of the elements in the annotation.

    // this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000');

    var win = Ti.UI.createWindow({ backgroundColor: '#fff' });

    var map = Titanium.Map.createView({

            mapType: Titanium.Map.STANDARD_TYPE,
            animate: true,
            regionFit: true,
            region: {latitude: 37.390749, longitude: -122.081651,latitudeDelta: 0.01, longitudeDelta: 0.01 }


    var myAnot = Titanium.Map.createAnnotation({

            latitude: 37.390749,
            longitude: -122.081651,
            title: 'You Clicked Me!',
            pincolor: Titanium.Map.ANNOTATION_PURPLE,
            animate: true


    map.addEventListener('click', function(e) {
    Titanium.API.info(e.clicksource); });


  13. Stephen Tramer 2011-04-15

    Assigning to Don so that we can get an Android ticket requesting feature parity.

  14. Stephen Tramer 2011-04-15

    Actually, scratch that. Going to make a new ticket for Android instead. Durr.

  15. Don Thorp 2011-04-15

    added release-1.7.0 tag.

  16. Eric Merriman 2011-05-11 No longer able to reproduce with iPhone 4, iOS 4.3.3. KS 1.7.0, build Tried both short test code and sample app. Both functioned as expected. Closing

JSON Source