Hi Ed,
thank you for your answer.
I tried to specify the view of the map through an MKCoordinateRegion, and I often get the same problem (but not always). When I zoom in from a large area (say 150km per cm scale) to my small region of interest, the scale says it is 2cm to 2.5km, but if I pan around a little, the scale immediately changes to 2cm to 1.25km.
It seems to me that the scale doesn't adapt to the last zoom. In fact, if I disable the animation, when I zoom in to the small region area the map scale remains at the initial value.
let mapRegion = MKCoordinateRegion(
center: annotation.coordinate,
span: MKCoordinateSpan(latitudeDelta: 0.05, longitudeDelta: 0.05)
)
setRegion(mapRegion, animated: true)
The situation improves with MKMapCamera: the scale is correct after zooming, but it only changes if I use animation.
let placemark = MKPlacemark(coordinate: annotation.coordinate)
let mapItem = MKMapItem(placemark: placemark)
let camera = MKMapCamera(
lookingAt: mapItem,
forViewSize: CGSize(
width: HALF_MAP_SIDE_MULTIPLIER * 2.0 * METERS_PER_MILE,
height: HALF_MAP_SIDE_MULTIPLIER * 2.0 * METERS_PER_MILE
),
allowPitch: false
)
setCamera(camera, animated: true)
Topic:
App & System Services
SubTopic:
Maps & Location
Tags: