Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14494] iOS: Ti.Map should handle touch events on the view not just annotations

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2018-01-29T03:41:33.000+0000
Affected Version/sRelease 2.1.4, Release 3.1.0, Release 3.1.1
Fix Version/sn/a
ComponentsiOS
LabelsTi.map, Titanium, iOS, mobilesdk
ReporterAshish Nigam
AssigneeVijay Singh
Created2013-07-08T13:36:20.000+0000
Updated2018-08-06T17:41:08.000+0000

Description

Touch events are currently only fired on Map Annotations and not else where on the map view. Implement touch events on the Map View.

Comments

  1. Blain Hamon 2013-08-15

    I'm looking at this now, but have concerns. [Apple's documentation](https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html) says, "Although you should not subclass the MKMapView class itself, you can get information about the map view’s behavior by providing a delegate object." We currently do, but this delegate gets events that are NOT the simple touch events. I'm currently looking at the feasibility of subclassing Map View anyways, to see if that even is a solution; it's possible that the event handling is done deep in the private bowels of MKMapView. The other option may be with gesture recognizers, but these are NOT the same as the touch handlers. May I enquire as to what you're trying to do with these listeners? Maybe there's a different solution that works better.
  2. Blain Hamon 2013-08-15

    Update: With a subclass of MKMapView, and listeners of the touch events, it turns out that the actual panning is started with a touch cancelled event. In other words, natively, the view events for moving about the map are: * touchstart once * touchmove three times before the map starts to pan. * touchcancel once as the map starts to pan. * never does a touchend event happen. A double-tap on the map is as follows: * touchstart once * touchcancel once as the map logic overrides. * never does a touchend event happen, nor a second touchstart. I am not sure that providing this behavior would be sufficient and meet the customer's needs.
  3. Blain Hamon 2013-08-15

    Looks like gestures won't help with panning or zooming either, unfortunately. Similarly, gestures for double-taps don't work, either. It's highly likely that we will not be able to provide touch events, due to the design of MKMapView. I don't want to resolve it as "Not our bug" (IE, Apple's fault) just yet without asking again: What is the intent? Is there a way we can create customer success by another means?
  4. Blain Hamon 2013-08-15

    Need information from the customer about what functionality they need. It's highly likely that iOS's MKMapView is such that this information cannot be provided.
  5. Blain Hamon 2013-08-23

    Actually, looking at this, we already fire a click event for an annotation selection and deselection.
  6. Blain Hamon 2013-08-23

    Please reopen with sample
  7. brian wells 2013-09-10

    Here is an sample app https://github.com/AppceleratorSolutions/TitaniumProjects/tree/master/MapExtensions This current solution for custom annotations that Alan created works great ... but the only way to close or remove an annotation from the screen is to move the map or click on another annotation. Other well done mobiles app, such as Zillow, Trulia, etc will remove the annotation from the map when the map is simply touched. We need the same user experience to happen in order to have a complete solution to what Alan has provided.
  8. Ranando King 2014-08-21

    I'm having similar trouble. We need our callout to handle click events. From what Apple's documentation says, subclassing MKMapView is both unwanted and unnecessary for this. A slight modification of TiMapCustomAnnotationView should be sufficient. Override (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event This should be used to return YES if point is in a non-transparent area of theProxy. That should fix the problem with (UIView *)hitTest:(CGPoint) point withEvent:(UIEvent *)event not returning a view when the callout is clicked. This will enable clickable callouts. I really need this feature today. I was trying to rebuild the map module for myself but ended up with an error that didn't make sense to me. Traceback (most recent call last): File "./build.py", line 220, in build_module(manifest,config) File "./build.py", line 165, in build_module from tools import ensure_dev_path ImportError: No module named tools Otherwise I'd be submitting a patch instead of suggesting how to fix this.
  9. Chee Kiat Ng 2015-05-29

    Deferring this due to lack of bandwidth this sprint.
  10. Vijay Singh 2018-01-26

    "mapclick" event get supported as part of MOD-2322.
  11. Eric Merriman 2018-08-06

    Closing as a duplicate. If this is in error, please reopen.

JSON Source