swati
swati

Reputation: 57

How to add the tilt effect in google map in ios?

enter image description hereI have added the following lines in my code to tilt the google map:

GMSCameraPosition* camera =
    [GMSCameraPosition cameraWithTarget:currentPosition zoom:20 bearing:self.locationManager.heading.trueHeading viewingAngle:30];
  _googleMapView.camera = camera;

    self.googleMapView.settings.tiltGestures = YES;

But it does not work.I can't find any tilt effect in my google map view by adding the above code.Here I have added two images.I'm getting the map like the second image.But,I need the map like the 1st image. enter image description here Please help.

Upvotes: 1

Views: 914

Answers (2)

Vinoth
Vinoth

Reputation: 9744

In Swift 4.2

You can tilt the google mapview using animate(toViewingAngle: ) function.

googleMapView.animate(toViewingAngle: 45)

Upvotes: 1

Thomas Maw
Thomas Maw

Reputation: 423

Instead of setting the _googleMapView.camera property directly use this method instead:

[_googleMapView animateToCameraPosition:camera];

EDIT: You can also use the following if you only want to change the camera tilt:

[_googleMapView animateToViewingAngle:30.0]

Just note that the angle needs to be between 30 and 45 degrees (Or 0 if you want the straight down view).

Upvotes: 1

Related Questions