In swift
I'm using MapKit
.
I set up the outlet @IBOutlet weak var mapView: MKMapView!
, used the MKMapViewDelegate
, and then I'm adding some annotations.
I was wondering if there's a possibility to show my map tilted and disable changing it until user zooms out the map. So basically when he zooms in - from the specific zoom level up to the closest zoom - he would only see this:
instead of this:
and changing this option by scrolling with two fingers should be locked. When user zooms out to some specific zoom level (e.g. country-wise), then it could switch to non-3d map. Is that achievable?
The MKMapView
has a property called camera
(details here) which is an instance of MKMapCamera
. You can use that property to set your desired angle. Be aware that the camera can be pitched only at certain zoom levels. Based on Apple's documentation you can check if the camera can be pitched at any given moment by checking the isPitchEnabled
property on the map view object.
Try using an instance of MKMapCamera
. From the documentation that should allow you to set the desired perspective angle and zoom level by setting it's pitch
, heading
and altitude
properties.
You can read more here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With