UNIQL
UNIQL

Reputation: 118

iOS Google Maps SDK - Pinch Gesture zoom effect without scrolling and position changing

I would like to make a pinch gesture in GMSMapView without changing the camera target. So I've added a UIPinchGestureRecognizer to block the scrollGestures in GMSUISettings.

- (void)zoomGestureHandler:(UIPinchGestureRecognizer *)recognizer
{
    if([recognizer state] == UIGestureRecognizerStatePossible)
    {

    }
    else if([recognizer state] == UIGestureRecognizerStateBegan)
    {
        NSLog(@"PINCH BEGAN\n");
        _mapView.settings.scrollGestures = NO;
    }
    else if([recognizer state] == UIGestureRecognizerStateChanged)
    {

    }
    else if([recognizer state] == UIGestureRecognizerStateEnded)
    {
        NSLog(@"PINCH END\n");
        _mapView.settings.scrollGestures = YES;
    }
    else if([recognizer state] == UIGestureRecognizerStateCancelled)
    {

    }
    else if([recognizer state] == UIGestureRecognizerStateFailed)
    {

    }
    else
    {

    }
}

It is working when slow pinch gestures done. If a user makes a quick pinch gesture the camera jumps away after the zoom animation. Does anyone has an idea how to achieve my goal with a solid solution? Thanks!

Upvotes: 0

Views: 852

Answers (1)

UNIQL
UNIQL

Reputation: 118

After reaching out google's bug center with the issue, they fixed it with an update.

Get google maps sdk: 1.10.0 or higher.

The solution is to simply add this line when configuring GMSMapview:

_mapView.settings.allowScrollGesturesDuringRotateOrZoom = NO;

Upvotes: 2

Related Questions