HERE iOS SDK Developer's Guide

<NMAMapGestureDelegate>

Protocol Summary

protocol <NMAMapGestureDelegate>

Derived from: <NSObject>

Delegate protocol for map gesture handling.

Include: NMAKit.framework/headers/NMAMapGesture.h

Inheritance Diagrams

Figure 1. Public inheritance diagram for <NMAMapGestureDelegate> – <NMAMapGestureDelegate>

[For complete information, see the section Protocol Details]

Instance Method Summary

Table 1. Instance Methods
Instance Method Summary

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveDoubleTapAtLocation:(CGPoint) location

Delegate callback for an NMAMapView double-tap gesture

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveLongPressAtLocation:(CGPoint) location

Delegate callback for an NMAMapView long press gesture

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceivePan:(CGPoint) translation atLocation:(CGPoint) location

Delegate callback for an NMAMapView pan gesture.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceivePinch:(float) pinch atLocation:(CGPoint) location

Delegate callback for an NMAMapView pinch gesture.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveRotation:(float) rotation atLocation:(CGPoint) location

Delegate callback for an NMAMapView rotation gesture.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveTapAtLocation:(CGPoint) location

Delegate callback for an NMAMapView tap gesture

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveTwoFingerPan:(CGPoint) translation atLocation:(CGPoint) location

Delegate callback for an NMAMapView two finger-pan gesture

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveTwoFingerTapAtLocation:(CGPoint) location

Delegate callback for an NMAMapView two finger-tap gesture

Protocol Details

Delegate protocol for map gesture handling.

This protocol should be implemented by any class which acts as the gesture delegate for a map view or any map subview which needs to receive gestures from the map view.

When a gesture is detected by the map view, the following steps are taken:

  1. The map checks whether a suitable subview can be found to handle the gesture (see below)
  2. If a suitable subview is found, the gesture is passed to it and the map takes no further action
  3. If a subview is not found, the NMAMapView's gestureDelegate is checked if present to see if it can handle the gesture type in question
  4. The gesture is passed to the delegate if it can handle it, and the map takes no further action
  5. Finally, if the gesture is still not handled, the NMAMapView takes the default action (e.g. panning, zooming, etc. depending on the type of gesture received)

In order for a map subview to accept a gesture which originates inside it, three conditions must be met: the view must be visible, it must implement the NMAMapGestureDelegate protocol, and it must implement the specific gesture handling method for the type of gesture in question. If a gesture hits a subview which cannot handle it, the NMAMApView will perform the same check on that view's superview. The view hierarchy is ascended in this manner until either the gesture is accepted or the NMAMapView itself is reached. Note that a subview using the NMAMapGestureDelegate protocol may implement any or all of the gesture handling methods.

The NMAMapView may optionally be provided with a gesture delegate, set via the gestureDelegate property. This delegate can be used to modify how the NMAMapView responds to some or all of its recognized gestures. The delegate class must implement the NMAMapGestureDelegate protocol; however, it need not implement all of the gesture handling methods. For any methods not implemented, the default behaviour will be used when that type of gesture is received. If specialized gesture behaviour is desired to the default behaviour, then the custom gesture handling method should invoke the implementation of that handling method on the map view's default gesture handler, accessed via the defaultGestureHandler property.

For example, to add behaviour when the map receives a tap, the delegate class implementation of the NMAMapGestureDelegate protocol method mapView:(NMAMapView*)mapView didReceiveTapAtLocation: could have the following form:

-(void)mapView:(NMAMapView*)mapView didReceiveTapAtLocation:(CGPoint)location
{
  // Some custom tap behaviour
  // ...  [mapView.defaultGestureHandler mapView:mapView didReceiveTapAtLocation:location];  // optional  // More custom tap behaviour
  // ...
}
Note:

Methods of this protocol will be called on the main queue.

Instance Method Details

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveDoubleTapAtLocation:(CGPoint) location

Delegate callback for an NMAMapView double-tap gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • location

    The screen location in points at which the gesture occurred.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveLongPressAtLocation:(CGPoint) location

Delegate callback for an NMAMapView long press gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • location

    The screen location in points at which the gesture occurred.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceivePan:(CGPoint) translation atLocation:(CGPoint) location

Delegate callback for an NMAMapView pan gesture.

The translation of a pan gesture is reported as the distance covered by the gesture since the last callback or since the beginning of the gesture. Note that this differs from the behaviour of UIPanGestureRecognizer, which reports the total translation since the beginning of the gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • translation

    The current translation of the pan gesture, in points.

  • location

    The screen location in points at which the gesture occurred.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceivePinch:(float) pinch atLocation:(CGPoint) location

Delegate callback for an NMAMapView pinch gesture.

The current pinch change is measured as the relative distance change of the two touch points since the last pinch callback or the beginning of the gesture. For example, if the pinch value is 1.2, the two touches are 20% farther apart than they were at the time of the last update. Note that this differs from the behaviour of UIPinchGestureRecognizer, which reports the total pinch since the beginning of the gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • pinch

    The current relative pinch change of the gesture.

  • location

    The screen location in points at which the gesture occurred.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveRotation:(float) rotation atLocation:(CGPoint) location

Delegate callback for an NMAMapView rotation gesture.

The current rotation is calculated as the net rotation that has occurred since the last rotation callback or since the beginning of the gesture. Note that this differs from the behaviour of UIRotationGestureRecognizer, which reports the total rotation since the beginning of the gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • rotation

    The current rotation of the gesture, in degrees.

  • location

    The screen location in points at which the gesture occurred.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveTapAtLocation:(CGPoint) location

Delegate callback for an NMAMapView tap gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • location

    The screen location in points at which the gesture occurred.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveTwoFingerPan:(CGPoint) translation atLocation:(CGPoint) location

Delegate callback for an NMAMapView two finger-pan gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • translation

    The current translation of the pan gesture, in points.

  • location

    The screen location in points at which the gesture occurred.

- @optional (void) mapView:(nonnull NMAMapView *) mapView didReceiveTwoFingerTapAtLocation:(CGPoint) location

Delegate callback for an NMAMapView two finger-tap gesture.

Parameters:

  • mapView

    The NMAMapView on which the gesture occurred.

  • location

    The screen location in points at which the gesture occurred.