Adam Adam - 1 year ago 91
Swift Question

Swift span zoom

Need simple coding for the span to zoom on the users location when the button is pressed. It follows the user but need span coding help.

i use this atm

@IBAction func Refreshbutton(sender: AnyObject) {
//Navigationsknappen

Mapview.userTrackingMode = .Follow
self.Locationmanager.stopUpdatingLocation()

}

Answer Source

This code may help you.

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