MapKit default scale

For some reason, my market will not approach the local region. In fact, it does not change the scale, no matter what I change. Am I loading it into the wrong part of the code, or am I missing something else? Any help is appreciated.

My code is:

@IBOutlet var here: MKMapView! var locationManager: CLLocationManager? var selectedItem: String? func locationManager (manager: CLLocationManager!,didUpdateToLocation newLocation: CLLocation!, fromLocation oldLocation: CLLocation!){ manager.desiredAccuracy = kCLLocationAccuracyBest var region = self.here.region as MKCoordinateRegion self.here.setRegion(region, animated: true) region.span.longitudeDelta = 0.0144927536 region.span.latitudeDelta = 0.0144927536 } 
+5
source share
1 answer

I believe you need to set lat and long before you set the scope. The setRegion function is something that scales to a specific part, and the zoom level depends on your range. Here is an example of a scalable map.

 let span = MKCoordinateSpanMake(0.075, 0.075) let region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: lat, longitude: long), span: span) mapView.setRegion(region, animated: true) 
+21
source

Source: https://habr.com/ru/post/1212495/


All Articles