Is there a way to show MKMapView at an angle (not directly above) at a specific zoom level?

In swift I use MapKit .

I set the output @IBOutlet weak var mapView: MKMapView! , used MKMapViewDelegate , and then add some annotations.

I was wondering if there is an opportunity to show my map inclined and turn off its change until the user zooms in on the map. Thus, basically, when he approaches - from a certain zoom level to the nearest zoom - he sees only this:

enter image description here

instead of this:

enter image description here

and changing this option by scrolling with two fingers should be blocked. When a user is scaled to a certain zoom level (for example, by country), he can switch to a non-3d map. Is it achievable?

+6
source share
2 answers

Later edit:

MKMapView has a camera property (more details here ), which is an instance of MKMapCamera . You can use this property to set the desired angle. Remember that the camera can only be broken at certain zoom levels. Based on Apple documentation, you can check if the camera can be broken at any time by checking the isPitchEnabled property on the map viewer.

Original answer

Try using an instance of MKMapCamera . From the documentation, which will allow you to set the desired perspective angle and zoom level by setting its pitch , heading and altitude properties.

You can read it here .

+3
source

try it

  camera.pitch = 85.0 camera.altitude = 223.0 camera.heading = 31.2 self.mapView.isPitchEnabled = true; self.mapView.showsBuildings = true; 
0
source

All Articles