Map Gestures (v2.0.x)

GESTURES WITH PREDEFINED BEHAVIOUR

After being created and added to the view hierarchy, NMMapView is ready to receive the user's touch events. The map reacts to the following gestures as described with no extra code needed.

  • Pan Gesture. To drag the map, touch the screen with one finger and hold. Move the finger in the desired direction.
  • Two-Fingers Pan Gesture. To change the map tilt, touch the screen with two fingers and hold. Move the fingers up or down the screen.
  • Swipe Gesture. To move the map with inertia, swipe the screen with one finger. The map will proceed to move in the same direction for a period of time depending on the velocity of the gesture.
  • Pinch Gesture. Touch the screen with two fingers and hold. Increase and decrease the distance between them to zoom in and zoom out respectively. Depending on the velocity of the gesture the map can have zoom inertia.
  • Rotation Gesture. Touch the screen with two fingers and hold. Rotate the fingers relative to the screen. This gesture also has inertia behaviour.

If you want to handle these gestures in your code please refer to HANDLING CAMERA EVENTS section. Note that in case of camera movement reason being a gesture or a combination of gestures you'll get NMCameraMovementReasonGesture in onCameraMovementStarted: method.

GESTURES WITHOUT PREDEFINED BEHAVIOUR

NMMapView recognizes the following gestures without a predefined behaviour. 

  • Single Tap Gesture. Tap the map with one finger once.
  • Double Tap Gesture. Tap the map with one finger twice.
  • Long Press Gesture. Touch the screen with one finger and hold for a period of time.

To process these gesture events make one your classes conform to the NMMapTapListener protocol and add it to NMMapView map tap listeners using the following code:

//anObject's class conforms to NMMapTapListener protocol
[mapView addMapTapListener:anObject];

You can add multiple map tap listeners to a NMMapView instance.

This way your object or objects will be notified on these gesture events throughout calling the following methods:

- (void)onSingleTap {
//define single tap gesture behaviour here
}

- (void)onDoubleTap {
//define double tap gesture behaviour here
}

- (void)onLongPress {
//define long press gesture behaviour here
}