view raw
Adam Adam - 8 months ago 60
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) {

Mapview.userTrackingMode = .Follow



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)