I\'m using a MKMapView inside an iPhone app. When I click a button the zoom level must increase. This is my first approach:
MKCoordinateRegion z
Just translated dkardel's solution to swift:
@IBAction func zoomOutButtonClicked(sender: UIButton) {
let span = MKCoordinateSpan(latitudeDelta: mapView.region.span.latitudeDelta*2, longitudeDelta: mapView.region.span.longitudeDelta*2)
let region = MKCoordinateRegion(center: mapView.region.center, span: span)
mapView.setRegion(region, animated: true)
}
@IBAction func zoomInButtonClicked(sender: UIButton) {
let span = MKCoordinateSpan(latitudeDelta: mapView.region.span.latitudeDelta/2, longitudeDelta: mapView.region.span.longitudeDelta/2)
let region = MKCoordinateRegion(center: mapView.region.center, span: span)
mapView.setRegion(region, animated: true)
}